Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34k
gh-142029: Raise ModuleNotFoundError instead of crashing on nonexsistent module name given to create_builtin()#142054
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
gh-142029: Raise ModuleNotFoundError instead of crashing on nonexsistent module name given to create_builtin()#142054
Uh oh!
There was an error while loading. Please reload this page.
Conversation
dr-carlos commented Nov 28, 2025 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
dr-carlos commented Nov 28, 2025
On further inspection, |
dr-carlos commented Dec 1, 2025
No longer relevant for the improved implementation. Thanks to @itamaro. |
dr-carlos commented Dec 1, 2025
Tests seem to be failing on Android/iOS because pickled Unfortunately it's not reproducible on my Linux computer (hence the Linux tests passing fine). Not sure if it's trying to compare the new |
vstinner left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer raising an exception as done in #142033 instead of returning None.
dr-carlos commented Dec 2, 2025
Sounds good. Would a |
None instead of crashing on nonexsistent module name given to create_builtin()ModuleNotFoundError instead of crashing on nonexsistent module name given to create_builtin()vstinner commented Dec 10, 2025
#142033 has been merged instead. |
dr-carlos commented Dec 11, 2025 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
@vstinner#142033 only fixes one of the two issues included in #142029. The first issue mentioned in that bug report is still unfixed, i.e. the following will crash on >>>import_imp>>>classA: pass ... >>>a=A() >>>a.name="123">>>_imp.create_builtin(a)But this would raise a |
itamaro commented Dec 11, 2025
vstinner left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. But there are now conflicts in Lib/test/test_import/init.py: can you try to solve them? (git merge main)
vstinner commented Dec 11, 2025
Oh sorry, I didn't see that the issue had two sub-issues. |
dr-carlos commented Dec 11, 2025
Yep, just done so. |
Uh oh!
There was an error while loading. Please reload this page.
vstinner commented Dec 12, 2025
Strange, pickle tests failed on iOS and Android: Example of failure: |
mhsmith commented Dec 13, 2025
This error came up in #103247, and I think @freakboy3742 dealt with a more recent instance, but I can't find it now. |
dr-carlos commented Dec 13, 2025
Thanks! |
dr-carlos commented Dec 14, 2025
Okay, manged to reproduce the error on Linux with |
cd2ca74 into python:mainUh oh!
There was an error while loading. Please reload this page.
vstinner commented Dec 15, 2025
Merged, thanks for the fix. |
bedevere-bot commented Dec 15, 2025
|
dr-carlos commented Dec 15, 2025
Unfortunately I'm unsure why this buildbot is failing - it's only happening on ARM Raspbian. It's not having issues importing anything (which is what this PR changes). Plus, the failure is only on this one specific test which seems totally unrelated. However, the test only seems to be failing after this commit, and it's happening now on other commits (27a2e49). |
…onexsistent module name given to `create_builtin()` (python#142054) Co-authored-by: Brett Cannon <[email protected]> Co-authored-by: Victor Stinner <[email protected]>
vstinner commented Dec 16, 2025
The failure seems to be unrelated. |
Py_NewRef(Py_None)was returned in this case; so, theoretically, this should be re-introducing behaviour that was previously broken by that commit.create_builtinwith invalid object #142029