Issue #17177: stop using imp for compileall.
diff --git a/Lib/compileall.py b/Lib/compileall.py
index a8e9a31..475dc1c 100644
--- a/Lib/compileall.py
+++ b/Lib/compileall.py
@@ -13,7 +13,7 @@
 import os
 import sys
 import errno
-import imp
+import importlib.util
 import py_compile
 import struct
 
@@ -91,17 +91,18 @@
             cfile = fullname + ('c' if __debug__ else 'o')
         else:
             if optimize >= 0:
-                cfile = imp.cache_from_source(fullname,
-                                              debug_override=not optimize)
+                cfile = importlib.util.cache_from_source(
+                                fullname, debug_override=not optimize)
             else:
-                cfile = imp.cache_from_source(fullname)
+                cfile = importlib.util.cache_from_source(fullname)
             cache_dir = os.path.dirname(cfile)
         head, tail = name[:-3], name[-3:]
         if tail == '.py':
             if not force:
                 try:
                     mtime = int(os.stat(fullname).st_mtime)
-                    expect = struct.pack('<4sl', imp.get_magic(), mtime)
+                    expect = struct.pack('<4sl', importlib.util.MAGIC_NUMBER,
+                                         mtime)
                     with open(cfile, 'rb') as chandle:
                         actual = chandle.read(8)
                     if expect == actual: