mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue #17177: Stop using imp in a bunch of tests
This commit is contained in:
parent
8a2a902f88
commit
9529fbfd36
7 changed files with 17 additions and 15 deletions
|
@ -1,7 +1,7 @@
|
|||
import sys
|
||||
import os
|
||||
import marshal
|
||||
import imp
|
||||
import importlib.util
|
||||
import struct
|
||||
import time
|
||||
import unittest
|
||||
|
@ -34,7 +34,8 @@ def make_pyc(co, mtime, size):
|
|||
mtime = int(mtime)
|
||||
else:
|
||||
mtime = int(-0x100000000 + int(mtime))
|
||||
pyc = imp.get_magic() + struct.pack("<ii", int(mtime), size & 0xFFFFFFFF) + data
|
||||
pyc = (importlib.util.MAGIC_NUMBER +
|
||||
struct.pack("<ii", int(mtime), size & 0xFFFFFFFF) + data)
|
||||
return pyc
|
||||
|
||||
def module_path_to_dotted_name(path):
|
||||
|
@ -49,7 +50,7 @@ TESTPACK = "ziptestpackage"
|
|||
TESTPACK2 = "ziptestpackage2"
|
||||
TEMP_ZIP = os.path.abspath("junk95142.zip")
|
||||
|
||||
pyc_file = imp.cache_from_source(TESTMOD + '.py')
|
||||
pyc_file = importlib.util.cache_from_source(TESTMOD + '.py')
|
||||
pyc_ext = ('.pyc' if __debug__ else '.pyo')
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue