From dd36b71fa6164ebba5d94bb4a24eac43b1c54906 Mon Sep 17 00:00:00 2001 From: Eric Snow Date: Fri, 11 Nov 2022 14:16:28 -0700 Subject: 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 --- Include/moduleobject.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'Include/moduleobject.h') diff --git a/Include/moduleobject.h b/Include/moduleobject.h index fbb2c5ae79..555564ec73 100644 --- a/Include/moduleobject.h +++ b/Include/moduleobject.h @@ -43,8 +43,22 @@ PyAPI_DATA(PyTypeObject) PyModuleDef_Type; typedef struct PyModuleDef_Base { PyObject_HEAD + /* The function used to re-initialize the module. + This is only set for legacy (single-phase init) extension modules + and only used for those that support multiple initializations + (m_size >= 0). + It is set by _PyImport_LoadDynamicModuleWithSpec() + and _imp.create_builtin(). */ PyObject* (*m_init)(void); + /* The module's index into its interpreter's modules_by_index cache. + This is set for all extension modules but only used for legacy ones. + (See PyInterpreterState.modules_by_index for more info.) + It is set by PyModuleDef_Init(). */ Py_ssize_t m_index; + /* A copy of the module's __dict__ after the first time it was loaded. + This is only set/used for legacy modules that do not support + multiple initializations. + It is set by _PyImport_FixupExtensionObject(). */ PyObject* m_copy; } PyModuleDef_Base; -- cgit v1.2.1