summaryrefslogtreecommitdiffstats
path: root/Lib/py_compile.py
diff options
context:
space:
mode:
authorBrett Cannon <brett@python.org>2013-06-15 18:07:21 (GMT)
committerBrett Cannon <brett@python.org>2013-06-15 18:07:21 (GMT)
commitdf960682a5d2d224627c0aaad77279f749af70ba (patch)
tree334e020eb89f2903118021e104d862c4f33067f4 /Lib/py_compile.py
parentfc06443c980e8ac5ebc2a1a6950cd7a85c49b5aa (diff)
downloadcpython-df960682a5d2d224627c0aaad77279f749af70ba.zip
cpython-df960682a5d2d224627c0aaad77279f749af70ba.tar.gz
cpython-df960682a5d2d224627c0aaad77279f749af70ba.tar.bz2
Issue #17177: Stop using imp with py_compile
Diffstat (limited to 'Lib/py_compile.py')
-rw-r--r--Lib/py_compile.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/Lib/py_compile.py b/Lib/py_compile.py
index cee35a5..9919deb 100644
--- a/Lib/py_compile.py
+++ b/Lib/py_compile.py
@@ -3,9 +3,9 @@
This module has intimate knowledge of the format of .pyc files.
"""
-import imp
import importlib._bootstrap
import importlib.machinery
+import importlib.util
import os
import os.path
import sys
@@ -105,9 +105,10 @@ def compile(file, cfile=None, dfile=None, doraise=False, optimize=-1):
"""
if cfile is None:
if optimize >= 0:
- cfile = imp.cache_from_source(file, debug_override=not optimize)
+ cfile = importlib.util.cache_from_source(file,
+ debug_override=not optimize)
else:
- cfile = imp.cache_from_source(file)
+ cfile = importlib.util.cache_from_source(file)
if os.path.islink(cfile):
msg = ('{} is a symlink and will be changed into a regular file if '
'import writes a byte-compiled file to it')