Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Lib/pathlib/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,8 @@ def glob(self, pattern, *, recurse_symlinks=True):
anchor, parts = _explode_path(pattern)
if anchor:
raise NotImplementedError("Non-relative patterns are unsupported")
elif not parts:
raise ValueError(f"Unacceptable pattern: {pattern!r}")
elif not recurse_symlinks:
raise NotImplementedError("recurse_symlinks=False is unsupported")
case_sensitive = self.parser.normcase('Aa') == 'Aa'
Expand Down
2 changes: 2 additions & 0 deletions Lib/test/test_pathlib/test_read.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ def check(pattern, expected):
check("**/file*",
["fileA", "dirA/linkC/fileB", "dirB/fileB", "dirC/fileC", "dirC/dirD/fileD",
"linkB/fileB"])
with self.assertRaisesRegex(ValueError, 'Unacceptable pattern'):
list(p.glob(''))

def test_walk_top_down(self):
it = self.root.walk()
Expand Down
Loading