[New-bugs-announce] [issue35570] 2to3 creates code using deprecated imp module

Hanno Boeck report at bugs.python.org
Sun Dec 23 07:58:37 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:

import sys

Running to 2to3 ends up with:
import sys
import imp

$ 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>

More information about the New-bugs-announce mailing list