mirror of
https://github.com/python/cpython.git
synced 2025-10-27 11:44:39 +00:00
Move some code from importlib.__init__ to importlib._bootstrap that
does not need to be exposed from C code for bootstrapping reasons.
This commit is contained in:
parent
b0f30c9891
commit
c264e3ee20
4 changed files with 52 additions and 42 deletions
|
|
@ -42,8 +42,8 @@ def __init__(self, path, magic=imp.get_magic()):
|
|||
self.bytecode_path = imp.cache_from_source(self.path)
|
||||
self.source_size = len(self.source)
|
||||
data = bytearray(magic)
|
||||
data.extend(marshal._w_long(self.source_mtime))
|
||||
data.extend(marshal._w_long(self.source_size))
|
||||
data.extend(importlib._w_long(self.source_mtime))
|
||||
data.extend(importlib._w_long(self.source_size))
|
||||
code_object = compile(self.source, self.path, 'exec',
|
||||
dont_inherit=True)
|
||||
data.extend(marshal.dumps(code_object))
|
||||
|
|
@ -658,8 +658,8 @@ def verify_code(self, code_object, *, bytecode_written=False):
|
|||
if bytecode_written:
|
||||
self.assertIn(self.cached, self.loader.written)
|
||||
data = bytearray(imp.get_magic())
|
||||
data.extend(marshal._w_long(self.loader.source_mtime))
|
||||
data.extend(marshal._w_long(self.loader.source_size))
|
||||
data.extend(importlib._w_long(self.loader.source_mtime))
|
||||
data.extend(importlib._w_long(self.loader.source_size))
|
||||
data.extend(marshal.dumps(code_object))
|
||||
self.assertEqual(self.loader.written[self.cached], bytes(data))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue