diff options
author | Eric Snow <ericsnowcurrently@gmail.com> | 2022-11-11 21:16:28 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-11 21:16:28 (GMT) |
commit | dd36b71fa6164ebba5d94bb4a24eac43b1c54906 (patch) | |
tree | b80a158cde971908ead6d89f7ed75c82b736992f /Objects | |
parent | fe55ff3f68d56e11526652a21d8fe27444f96224 (diff) | |
download | cpython-dd36b71fa6164ebba5d94bb4a24eac43b1c54906.zip cpython-dd36b71fa6164ebba5d94bb4a24eac43b1c54906.tar.gz cpython-dd36b71fa6164ebba5d94bb4a24eac43b1c54906.tar.bz2 |
gh-81057: Move the Extension Modules Cache to _PyRuntimeState (gh-99355)
We also move the closely related max_module_number and add comments documenting the group of struct members.
https://github.com/python/cpython/issues/81057
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/moduleobject.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/Objects/moduleobject.c b/Objects/moduleobject.c index a1d09a6..4a423a7 100644 --- a/Objects/moduleobject.c +++ b/Objects/moduleobject.c @@ -9,7 +9,6 @@ #include "pycore_moduleobject.h" // _PyModule_GetDef() #include "structmember.h" // PyMemberDef -static Py_ssize_t max_module_number; static PyMemberDef module_members[] = { {"__dict__", T_OBJECT, offsetof(PyModuleObject, md_dict), READONLY}, @@ -43,10 +42,10 @@ PyModuleDef_Init(PyModuleDef* def) { assert(PyModuleDef_Type.tp_flags & Py_TPFLAGS_READY); if (def->m_base.m_index == 0) { - max_module_number++; + _PyRuntime.imports.last_module_index++; Py_SET_REFCNT(def, 1); Py_SET_TYPE(def, &PyModuleDef_Type); - def->m_base.m_index = max_module_number; + def->m_base.m_index = _PyRuntime.imports.last_module_index; } return (PyObject*)def; } |