GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — [3.15] gh-155194: Fix not raising on non-module import by DinoV · Pull Request #155188 · python/cpython Conversation
|
| assert_python_ok("-c", code) | ||
|
|
||
| def test_non_package_lazily_imported(self): | ||
| """Accessing a nonexistent lazy submodule via parent attr raises AttributeError.""" |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
| """Accessing a nonexistent lazy submodule via parent attr raises AttributeError.""" | |
| """Accessing a nonexistent lazy submodule via parent attr raises ModuleNotFoundError.""" |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| ); | ||
| Py_DECREF(name); | ||
| } | ||
| obj = _PyEval_ImportNameWithImport( |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Hm, does this change the error for lazy from ... import nonexistent_attr? We don't seem to have explicit tests for what that raises, just the chaining test?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Nope, that'll be the same. In the from case we're already doing a full import (it's probably not super clear here because that's when lz_attr is not NULL and that's maybe not the best name)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Is there a reason there is a 3.15 specific PR here rather than backporting the one targeting main once that's merged? #155189 If so, it might be good to explain that in the PR description. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Mainly because if we don't fix it in 3.15 I don't think we should ever fix it - it would probably be a breaking change as people would come to depend upon it so I think we should fix it here first or not fix it at all. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Let's get Hugo's opinion on getting this into the next RC then, and if he's okay with that, apply it to main first. (Doing things in the other direction makes future merges more awkward.) FWIW, I think this is such a clear corner case that I think it would be fine to change in 3.15.1 as well, but I'm not in charge :) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@hugovk ^ |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Yes, let's fix this for rc2, and do it in |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Some comments
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
| assert_python_ok("-c", code) | ||
|
|
||
| def test_non_package_lazily_imported(self): | ||
| """Accessing a nonexistent lazy submodule via parent attr raises ModuleNotFoundError.""" |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Nit: math.pi is an existing non-module attribute, and sys.doesnotexist is a missing attribute rather than a submodule. Can we describe those cases directly?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
@pablogsal I've fixed up these in the main PR (#155189), I'm going to close this one per the discussion above.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.