summaryrefslogtreecommitdiffstats
path: root/Lib/inspect.py
diff options
context:
space:
mode:
authorBrett Cannon <brett@python.org>2013-06-16 17:13:40 (GMT)
committerBrett Cannon <brett@python.org>2013-06-16 17:13:40 (GMT)
commite4f41deccf94ccc798b1eb1f44657ade66669a60 (patch)
tree8f47ca73224c628f4afcebb9dd989cac73d0f8d1 /Lib/inspect.py
parent39295e7a55d03b9ef31c0d0dd27d129b1ad5a695 (diff)
downloadcpython-e4f41deccf94ccc798b1eb1f44657ade66669a60.zip
cpython-e4f41deccf94ccc798b1eb1f44657ade66669a60.tar.gz
cpython-e4f41deccf94ccc798b1eb1f44657ade66669a60.tar.bz2
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).
Diffstat (limited to 'Lib/inspect.py')
-rw-r--r--Lib/inspect.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/inspect.py b/Lib/inspect.py
index 378e22f..d788525 100644
--- a/Lib/inspect.py
+++ b/Lib/inspect.py
@@ -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()]