New submission from Cristian Ciupitu <cristian.ciup...@yahoo.com>:

pathlib.Path.glob and pathlib.Path.rglob don't work with os.PathLike patterns.

Short example:

from pathlib import Path, PurePath
# fails
tuple(Path('/etc').glob(PurePath('passwd')))    # TypeError
tuple(Path('/etc').rglob(PurePath('passwd')))   # TypeError
tuple(Path('C:\\').glob(PurePath('Windows')))   # AttributeError
tuple(Path('C:\\').rglob(PurePath('Windows')))  # AttributeError
# works
from os import fspath
tuple(Path('/etc').glob(fspath(PurePath('passwd'))))
tuple(Path('/etc').rglob(fspath(PurePath('passwd'))))
tuple(Path('C:\\').glob(fspath(PurePath('Windows'))))
tuple(Path('C:\\').rglob(fspath(PurePath('Windows'))))

----------
components: Library (Lib)
messages: 331491
nosy: ciupicri
priority: normal
severity: normal
status: open
title: pathlib.Path: glob and rglob should accept PathLike patterns
versions: Python 3.7

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue35453>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to