Skip to content

Commit 7af28b3

Browse files
committed
Move sys.implementation -> _imp
1 parent cec0885 commit 7af28b3

File tree

3 files changed

+5
-10
lines changed

3 files changed

+5
-10
lines changed

Lib/importlib/_bootstrap_external.py

Lines changed: 1 addition & 1 deletion
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 = (sys.implementation._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
_RAW_MAGIC_NUMBER = int.from_bytes(MAGIC_NUMBER, 'little') # for import.c
227227

Python/import.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4826,6 +4826,10 @@ imp_module_exec(PyObject *module)
48264826
return -1;
48274827
}
48284828

4829+
if (PyModule_AddIntConstant(module, "_pyc_magic_number", PYC_MAGIC_NUMBER) < 0) {
4830+
return -1;
4831+
}
4832+
48294833
return 0;
48304834
}
48314835

Python/sysmodule.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ Data members:
2121
#include "pycore_frame.h" // _PyInterpreterFrame
2222
#include "pycore_initconfig.h" // _PyStatus_EXCEPTION()
2323
#include "pycore_long.h" // _PY_LONG_MAX_STR_DIGITS_THRESHOLD
24-
#include "pycore_magic_number.h" // PYC_MAGIC_NUMBER
2524
#include "pycore_modsupport.h" // _PyModule_CreateInitialized()
2625
#include "pycore_namespace.h" // _PyNamespace_New()
2726
#include "pycore_object.h" // _PyObject_DebugTypeStats()
@@ -3320,14 +3319,6 @@ make_impl_info(PyObject *version_info)
33203319
if (res < 0)
33213320
goto error;
33223321

3323-
value = PyLong_FromLong(PYC_MAGIC_NUMBER);
3324-
if (value == NULL)
3325-
goto error;
3326-
res = PyDict_SetItemString(impl_info, "_pyc_magic_number", value);
3327-
Py_DECREF(value);
3328-
if (res < 0)
3329-
goto error;
3330-
33313322
#ifdef MULTIARCH
33323323
value = PyUnicode_FromString(MULTIARCH);
33333324
if (value == NULL)

0 commit comments

Comments
 (0)