-
-
Notifications
You must be signed in to change notification settings - Fork 30.9k
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
runpy calls open_code with Path object #83698
Comments
runpy accepts Path like objects but open_code seems to only accept strings, so calling open_code with Path object throws TypeError. |
Is there documentation in runpy where it's stated that path objects are accepted for the function? If not this seems to be an enhancement. |
Can't see anything about this in the docs, I just noticed that it breaks shiv after upgrade. |
Not a direct solution, but I have offered that io.open_code should be changed to support pathlike objects: https://bugs.python.org/issue39691 |
open_code is correct according to PEP-578, so the fix here is for runpy to ensure the path is absolute and pass it through os.fsdecode() before calling io.open_code(). |
Hey there, the PR was approved a week ago, is there a reason it is not merged yet? |
Nope, just that I apparently forgot to merge (or forgot to come back after CI had finished). Thanks for the reminder! |
Great, thank you! |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: