Skip to content

Commit 4d682b3

Browse files
Update pathlib.py Path.glob()
Fix glob() to return Path objects rather than bare strings, same as CPython https://docs.python.org/3/library/pathlib.html#pathlib.Path.glob Signed-off-by: RotatingLlama <[email protected]>
1 parent 913498e commit 4d682b3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

python-stdlib/pathlib/pathlib.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def _glob(self, path, pattern, recursive):
126126
for name, mode, *_ in os.ilistdir(path):
127127
full_path = path + _SEP + name
128128
if name.startswith(prefix) and name.endswith(suffix):
129-
yield full_path
129+
yield Path(full_path)
130130
if recursive and mode & 0x4000: # is_dir
131131
yield from self._glob(full_path, pattern, recursive=recursive)
132132

0 commit comments

Comments
 (0)