-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
bpo-38735: Don't fail when importing from / with sys.pycache_prefix set #30456
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
Conversation
|
This PR is stale because it has been open for 30 days with no activity. |
|
You can test it without writing a file. >>> from importlib.util import cache_from_source
>>> import os
>>> os.chdir('/')
>>> cache_from_source('spam.py')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
cache_from_source('spam.py')
~~~~~~~~~~~~~~~~~^^^^^^^^^^^
File "<frozen importlib._bootstrap_external>", line 558, in cache_from_source
IndexError: string index out of range |
|
Thanks @encukou for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13. |
|
Thanks @encukou for the PR 🌮🎉.. I'm working now to backport this PR to: 3.14. |
…et (pythonGH-30456) (cherry picked from commit d8a9466) Co-authored-by: Petr Viktorin <[email protected]> Co-authored-by: Serhiy Storchaka <[email protected]>
…et (pythonGH-30456) (cherry picked from commit d8a9466) Co-authored-by: Petr Viktorin <[email protected]> Co-authored-by: Serhiy Storchaka <[email protected]>
|
GH-137905 is a backport of this pull request to the 3.13 branch. |
|
GH-137906 is a backport of this pull request to the 3.14 branch. |
…et (pythonGH-30456) Co-authored-by: Serhiy Storchaka <[email protected]>
|
GH-137905 is a backport of this pull request to the 3.13 branch. |
|
GH-137906 is a backport of this pull request to the 3.14 branch. |
…efix set (GH-30456) (GH-137905) (cherry picked from commit d8a9466) Co-authored-by: Petr Viktorin <[email protected]> Co-authored-by: Serhiy Storchaka <[email protected]>
…efix set (GH-30456) (GH-137906) (cherry picked from commit d8a9466) Co-authored-by: Petr Viktorin <[email protected]> Co-authored-by: Serhiy Storchaka <[email protected]>
This fixes the issue, but testing it would require putting a file in the root directory.
https://bugs.python.org/issue38735
gh-#82916