-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Inconsistent behaviour in wildcard import #7669
Comments
Hi @vepadulano, sorry for the very late reply 😛 I think doing from In fact, it doesn't even work when I try it with ROOT master (it just takes forever, the execution never finishes). So in that sense, we also don't have any inconsistent behavior anymore :) In fact, maybe we can just make it explicit that this is not supported by raising an exception here? What do you think? |
Indeed it is quite a bad idea in general and I would really like to avoid it 😄 https://docs.python.org/3/tutorial/modules.html#importing-from-a-package
This is a bug unfortunately 🥲
Raising the exception is ok, but will break (probably many) existing applications. I am not saying it is a bad thing per se, but maybe we want to soft-break it first with a warning and then break it in a future ROOT release. Need to think about it a bit more, because this will also change whenever we get rid of the facade. But in principle I agree it is the correct way forward |
We should discuss this matter further. Perhas a soft-break first, à la Python2 deprecation, might be a good starting point. |
A soft-break would require the effort of fixing the wild card import just to drop it afterwards.... There is a structural problem with Python 3.11 that prevents the wildcard import with the lazy lookup to work. Upstream CPyCppyy dropped that feature even:
The dropped @vepadulano, given this new information that it will never work with Python 3.11 onward, maybe we should remove the code path for |
A soft-break with deprecation warning could still be useful for users of Python 3.8, 3.9 or 3.10, but I doubt that it's worth it, given that no user even noticed that |
Wild card imports like `from ROOT import *` stopped working with Python 3.11 given some changes in the CPython API. For that reason, upstream `cppyy` also dropped support for lazy lookups, which was the feature that enabled wildcard imports: wlav/CPyCppyy@64fd890#diff-6160c0eb004dabeedaeb58d804a7ecd3e563d9379e9e7af39623fd38d0bc6a37R352 This commit suggests to document `from ROOT import *` officially as unsupported and remove the corresponding code path in the ROOT facade. Closes root-project#7669.
I am always wary about dropping support for a feature completely without a deprecation notice, even if that feature was buggy and incomplete. This might be one occasion where we simply can't do otherwise |
Wild card imports like `from ROOT import *` stopped working with Python 3.11 given some changes in the CPython API. For that reason, upstream `cppyy` also dropped support for lazy lookups, which was the feature that enabled wildcard imports: wlav/CPyCppyy@64fd890#diff-6160c0eb004dabeedaeb58d804a7ecd3e563d9379e9e7af39623fd38d0bc6a37R352 This commit suggests to document `from ROOT import *` officially as unsupported and remove the corresponding code path in the ROOT facade. Closes #7669.
Describe the bug
Some classes are imported in the Python session namespace when wildcard import is used, while others aren't:
Expected behavior
We should be able to tell more consistenty which names are available after wildcard import, it is handled here .
To Reproduce
from ROOT import *
in a python sessionSetup
ROOT master@34fc1dc
Fedora 32
built from source
Additional context
This issue stems from #7436
The text was updated successfully, but these errors were encountered: