You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Stop using deprecated imp module; imp should now emit a real DeprecationWarning #69347
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:
assignee=Noneclosed_at=<Date2020-06-05.18:36:26.036>created_at=<Date2015-09-18.07:06:19.691>labels= ['3.8', 'type-feature', 'library']
title='Stop using deprecated imp module; imp should now emit a real DeprecationWarning'updated_at=<Date2020-06-05.18:36:26.035>user='https://github.com/vstinner'
The imp module is deprecated since Python 3.4. In Python 3.4, imp uses a PendingDeprecationWarning, and Python 3.5... hum, still a PendingDeprecationWarning. It was not supposed to become a real DeprecationWarning?
Anyway, the imp module is still used in some places of the Python stdlib:
I meant to comment on a different issue, the trigger is stuff like https://bugs.python.org/issue39015 (new deprecationwarnings being generated without cleaning up the standard library first).
Activity
vstinner commentedon Sep 18, 2015
The imp module is deprecated since Python 3.4. In Python 3.4, imp uses a PendingDeprecationWarning, and Python 3.5... hum, still a PendingDeprecationWarning. It was not supposed to become a real DeprecationWarning?
Anyway, the imp module is still used in some places of the Python stdlib:
Lib/modulefinder.py:14: import imp
Python/makeopcodetargets.py:9:import imp
Tools/i18n/pygettext.py:159:import imp
Tools/importbench/importbench.py:10:import imp
modulefinder explicitly ignore the warning :-(
berkerpeksag commentedon Sep 18, 2015
See bpo-20021.
python-dev commentedon Sep 18, 2015
New changeset 03cd8340e0ce by Victor Stinner in branch '3.5':
Issue bpo-25160: Fix import_init() comments and messages
https://hg.python.org/cpython/rev/03cd8340e0ce
berkerpeksag commentedon Sep 18, 2015
I forgot to link bpo-20020 in my earlier message :)
vstinner commentedon Mar 25, 2016
I opened the issue bpo-26639 for it.
I pushed the change f682b620c64d but I forgot about the issue bpo-20021. Let's discuss there about this script.
I think that it's fine to keep imp there.
This one requires more work than the other.
JelleZijlstra commentedon Jun 2, 2016
Current status:
I'll work on replacing some of these.
JelleZijlstra commentedon Jun 2, 2016
One more:
berkerpeksag commentedon Jun 2, 2016
There is an already open issue for this: bpo-21446.
ncoghlan commentedon Apr 7, 2019
Fixed for Python 3.8 via the patch for bpo-35936.
ncoghlan commentedon Apr 7, 2019
Oops, this covers more than just modulefinder - reopening until the other remaining uses of the imp module have been removed.
isidentical commentedon Dec 7, 2019
@vstinner
Any reason to keep imp there? We can just port it to sole importlib (it already uses it in some places)
brettcannon commentedon Dec 9, 2019
Nope, not anymore.
ambv commentedon Dec 10, 2019
Make sure the standard library doesn't emit those warnings itself.
ambv commentedon Dec 10, 2019
I meant to comment on a different issue, the trigger is stuff like https://bugs.python.org/issue39015 (new deprecationwarnings being generated without cleaning up the standard library first).
brettcannon commentedon Jun 5, 2020
imp has been moved to DeprecationWarning and I think its usage in the stdlib has been dealt with at this point.