[issue35570] 2to3 creates code using deprecated imp module
Hanno Boeck
report at bugs.python.org
Sun Dec 23 07:58:39 EST 2018
New submission from Hanno Boeck <hanno at hboeck.de>:
2to3 (in python 3.6.6) will rewrite the reload function to use the imp module. However according to [1] "Deprecated since version 3.4: The imp package is pending deprecation in favor of importlib."
Also running the code with warnings enabled will show a deprecation warning.
Example, take this minimal script:
#!/usr/bin/python
import sys
reload(sys)
Running to 2to3 ends up with:
#!/usr/bin/python
import sys
import imp
imp.reload(sys)
$ PYTHONWARNINGS=d python3 foo.py
test.py:3: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
import imp
[1] https://docs.python.org/3/library/imp.html
----------
components: 2to3 (2.x to 3.x conversion tool)
messages: 332390
nosy: hanno
priority: normal
severity: normal
status: open
title: 2to3 creates code using deprecated imp module
versions: Python 3.6
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue35570>
_______________________________________
More information about the Python-bugs-list
mailing list