mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
Issue #17177: The imp module is pending deprecation.
To make sure there is no issue with code that is both Python 2 and 3 compatible, there are no plans to remove the module any sooner than Python 4 (unless the community moves to Python 3 solidly before then).
This commit is contained in:
parent
39295e7a55
commit
e4f41deccf
15 changed files with 103 additions and 85 deletions
|
@ -31,7 +31,6 @@ Here are some of the useful functions provided by this module:
|
|||
__author__ = ('Ka-Ping Yee <ping@lfw.org>',
|
||||
'Yury Selivanov <yselivanov@sprymix.com>')
|
||||
|
||||
import imp
|
||||
import importlib.machinery
|
||||
import itertools
|
||||
import linecache
|
||||
|
@ -440,6 +439,9 @@ def getmoduleinfo(path):
|
|||
"""Get the module name, suffix, mode, and module type for a given file."""
|
||||
warnings.warn('inspect.getmoduleinfo() is deprecated', DeprecationWarning,
|
||||
2)
|
||||
with warnings.catch_warnings():
|
||||
warnings.simplefilter('ignore', PendingDeprecationWarning)
|
||||
import imp
|
||||
filename = os.path.basename(path)
|
||||
suffixes = [(-len(suffix), suffix, mode, mtype)
|
||||
for suffix, mode, mtype in imp.get_suffixes()]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue