diff options
author | Brett Cannon <brett@python.org> | 2013-06-15 18:25:04 (GMT) |
---|---|---|
committer | Brett Cannon <brett@python.org> | 2013-06-15 18:25:04 (GMT) |
commit | f4ba4ec1604fe84a9665d4de0767943f58417f24 (patch) | |
tree | 4fb03b16760e6a5c19f4cc71f9850bd04c3c165b /Lib/pydoc.py | |
parent | df960682a5d2d224627c0aaad77279f749af70ba (diff) | |
download | cpython-f4ba4ec1604fe84a9665d4de0767943f58417f24.zip cpython-f4ba4ec1604fe84a9665d4de0767943f58417f24.tar.gz cpython-f4ba4ec1604fe84a9665d4de0767943f58417f24.tar.bz2 |
Issue #17177: Stop using imp in pydoc
Diffstat (limited to 'Lib/pydoc.py')
-rwxr-xr-x | Lib/pydoc.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/Lib/pydoc.py b/Lib/pydoc.py index 2e9b6d5..9cc3126 100755 --- a/Lib/pydoc.py +++ b/Lib/pydoc.py @@ -44,17 +44,16 @@ Richard Chamberlain, for the first implementation of textdoc. """ # Known bugs that can't be fixed here: -# - imp.load_module() cannot be prevented from clobbering existing -# loaded modules, so calling synopsis() on a binary module file -# changes the contents of any existing module with the same name. +# - synopsis() cannot be prevented from clobbering existing +# loaded modules. # - If the __file__ attribute on a module is a relative path and # the current directory is changed with os.chdir(), an incorrect # path will be displayed. import builtins -import imp import importlib._bootstrap import importlib.machinery +import importlib.util import inspect import io import os @@ -268,7 +267,7 @@ class ErrorDuringImport(Exception): def importfile(path): """Import a Python source file or compiled file given its path.""" - magic = imp.get_magic() + magic = importlib.util.MAGIC_NUMBER with open(path, 'rb') as file: is_bytecode = magic == file.read(len(magic)) filename = os.path.basename(path) |