-
-
Notifications
You must be signed in to change notification settings - Fork 29.1k
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
Deprecate imp.find_module()/load_module() #59002
Comments
With importlib.find_loader() now implemented, imp.find_module() (and its companion, imp.load_module()) can go away and stop inflicting their bad API upon the world. The trick, though, is fixing code that uses the API. That means pkgutil, multiprocessing.forking, modulefinder, and idlelib.EditorWindow all need to be patched to stop using imp.find_module()/load_module(). |
http://hg.python.org/lookup/59870239813c documents imp.find_module/load_module as deprecated w/o actually raising the deprecation. The code works fine, but the API is just crap. So in the name of ease of transition (and my own personal sanity), I didn't go full-blown deprecation. The remaining code that uses imp.find_module() in the stdlib uses the API's unique properties (e.g. executing under a different name in multiprocessing) or directly exposes the API (e.g. pkgutil and modulefinder). As for idle, I don't run the tool so I don't feel like editing the code and getting it wrong. |
BTW, I'm leaving this issue open in case someone wants to take a stab and removing the uses of imp.find_module()/load_module() from the stdlb. |
Assuming issue bpo-17314 gets fixed, that leaves the following uses of imp.find_module(): Lib/idlelib/EditorWindow.py Lib/modulefinder.py Lib/pkgutil.py Lib/test/test_imp.py Lib/test/test_import.py Lib/test/test_importhooks.py |
The remaining uses of imp.load_module() after issue bpo-17314 (which will probably all disappear as uses of imp.find_module() is removed): Lib/idlelib/EditorWindow.py Lib/pkgutil.py Lib/pydoc.py Lib/test/test_imp.py Lib/test/test_importhooks.py |
Current status (with test_imp stripped out):
Lib/pkgutil.py Lib/pydoc.py Lib/test/test_importhooks.py |
The modulefinder usage is directly exposed in its API as the return value of a find_module method, which makes removal a pain. Adding Thomas Heller to see what he has to say. The pkgutil usage is in classes that have been deprecated, so don't care. The rest should be workable and I will file separate bugs. |
Some months ago, I have started to implement a brand-new modulefinder, IMO it is not yet ready for inclusion into Python 3.4, but given the If someone wants to read the code, or try it out: Modulefinder: Test: Thomas |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: