-
-
Notifications
You must be signed in to change notification settings - Fork 30.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
All standard library functions accepting str
paths must accept PathLike
as well
#102425
Comments
str
paths must accept PathLike
as wellstr
paths must accept PathLike
as well
It’s not clear to me what you’re proposing to change. Can you provide specifics? How would |
Note that importing
How can the error message from |
I'm confused, |
Closing in favor of gh-103659. |
Reopening after #103659 (comment):
However, I'll return to this issue much later. |
No need to reopen this for my comment on #103659 , I tried to say that this issue is not a reason for changing the behaviour of |
Inspired by gh-3484 that tried to fix this for
wave.open()
only but failed.We need a centralized and universal approach instead so everything accepting
str
paths could automatically acceptPathLike
for free.For this, we can amend stdlib functions to wrap their path arguments into
pathlib.PurePath
introduced in Python 3.4. Unlikeos.fspath
, it throws a nicely formatted exception for us:os.fspath
from the mentioned bpo-31412: wave.open takes a path-like object #3484:cpython/Lib/aifc.py
Lines 912 to 918 in 4a82d65
PurePath
:The text was updated successfully, but these errors were encountered: