Skip to content

Commit 3b79b94

Browse files
committed
_pyc_magic_number -> pyc_magic_number
1 parent 33c9d36 commit 3b79b94

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

Lib/importlib/_bootstrap_external.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ def _write_atomic(path, data, mode=0o666):
221221

222222
_code_type = type(_write_atomic.__code__)
223223

224-
MAGIC_NUMBER = (_imp._pyc_magic_number).to_bytes(2, 'little') + b'\r\n'
224+
MAGIC_NUMBER = (_imp.pyc_magic_number).to_bytes(2, 'little') + b'\r\n'
225225

226226
_PYCACHE = '__pycache__'
227227
_OPT = 'opt-'
@@ -860,7 +860,7 @@ def get_code(self, fullname):
860860
_imp.check_hash_based_pycs == 'always')):
861861
source_bytes = self.get_data(source_path)
862862
source_hash = _imp.source_hash(
863-
_imp._pyc_magic_number_token,
863+
_imp.pyc_magic_number_token,
864864
source_bytes,
865865
)
866866
_validate_hash_pyc(data, source_hash, fullname,
@@ -889,7 +889,7 @@ def get_code(self, fullname):
889889
source_mtime is not None):
890890
if hash_based:
891891
if source_hash is None:
892-
source_hash = _imp.source_hash(_imp._pyc_magic_number_token,
892+
source_hash = _imp.source_hash(_imp.pyc_magic_number_token,
893893
source_bytes)
894894
data = _code_to_hash_pyc(code_object, source_hash, check_source)
895895
else:

Lib/importlib/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
def source_hash(source_bytes):
1919
"Return the hash of *source_bytes* as used in hash-based pyc files."
20-
return _imp.source_hash(_imp._pyc_magic_number_token, source_bytes)
20+
return _imp.source_hash(_imp.pyc_magic_number_token, source_bytes)
2121

2222

2323
def resolve_name(name, package):

Lib/test/test_import/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3116,10 +3116,10 @@ def test_pyimport_addmodule_create(self):
31163116
@cpython_only
31173117
class TestMagicNumber(unittest.TestCase):
31183118
def test_magic_number_endianness(self):
3119-
magic_number = (_imp._pyc_magic_number).to_bytes(2, 'little') + b'\r\n'
3119+
magic_number = (_imp.pyc_magic_number).to_bytes(2, 'little') + b'\r\n'
31203120
raw_magic_number = int.from_bytes(magic_number, 'little')
31213121

3122-
assert raw_magic_number == _imp._pyc_magic_number_token
3122+
assert raw_magic_number == _imp.pyc_magic_number_token
31233123

31243124

31253125
if __name__ == '__main__':

Lib/zipimport.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,7 @@ def _unmarshal_code(self, pathname, fullpath, fullname, data):
705705
source_bytes = _get_pyc_source(self, fullpath)
706706
if source_bytes is not None:
707707
source_hash = _imp.source_hash(
708-
_imp._pyc_magic_number_token,
708+
_imp.pyc_magic_number_token,
709709
source_bytes,
710710
)
711711

Python/import.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4811,11 +4811,11 @@ imp_module_exec(PyObject *module)
48114811
return -1;
48124812
}
48134813

4814-
if (PyModule_AddIntConstant(module, "_pyc_magic_number", PYC_MAGIC_NUMBER) < 0) {
4814+
if (PyModule_AddIntConstant(module, "pyc_magic_number", PYC_MAGIC_NUMBER) < 0) {
48154815
return -1;
48164816
}
48174817

4818-
if (PyModule_AddIntConstant(module, "_pyc_magic_number_token", PYC_MAGIC_NUMBER_TOKEN) < 0) {
4818+
if (PyModule_AddIntConstant(module, "pyc_magic_number_token", PYC_MAGIC_NUMBER_TOKEN) < 0) {
48194819
return -1;
48204820
}
48214821

0 commit comments

Comments
 (0)