-
-
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
Import errors with loo long entry in sys.path or PYTHONPATH in Windows #122353
Comments
As discussed in #122228, on Windows going back to 3.3, the C |
I'm not convinced that these errors should be handled. OSErrors are caused by things outside of the control of the caller (assuming correct inputs), but ValueErrors indicate that the caller passed something invalid. A path longer than 32K is never valid, so it never should've gotten in there, so the caller should be informed - in this case, the user. What's the real scenario where this mattered? All I see is a very contrived scenario to cause the error, but no information about how it was encountered or why simply ignoring corrupt data would've been a better result. |
It is possible that the path to the |
Agreed. But again, let's take each case like this individually - not being able to iterate over files in an invalid |
Me neither, I created these issues so informed decisions could be made on the need to guard against them. Thanks for analyzing |
Bug report
Bug description:
Having too long entries in
sys.path
orPYTHONPATH
in Windows will cause different errors in imports. This was first reported on #122170, where there is some useful discussion.CPython versions tested on:
3.13, CPython main branch
Operating systems tested on:
Windows
Linked PRs
ValueError
during imports #122389The text was updated successfully, but these errors were encountered: