From 0ab3d8b5099e3f0ed390a282d3c24ae087550c20 Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Fri, 14 Nov 2025 16:20:29 +0100 Subject: [PATCH 1/3] Add earlier Py_mod_* constants to stable ABI manifest --- Doc/data/stable_abi.dat | 4 ++++ Misc/stable_abi.toml | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/Doc/data/stable_abi.dat b/Doc/data/stable_abi.dat index 95e032655cf0cc..8b59cecb1903cc 100644 --- a/Doc/data/stable_abi.dat +++ b/Doc/data/stable_abi.dat @@ -980,8 +980,12 @@ macro,Py_bf_releasebuffer,3.11,, type,Py_buffer,3.11,,full-abi type,Py_intptr_t,3.2,, macro,Py_mod_abi,3.15,, +macro,Py_mod_create,3.5,, macro,Py_mod_doc,3.15,, +macro,Py_mod_exec,3.5,, +macro,Py_mod_gil,3.12,, macro,Py_mod_methods,3.15,, +macro,Py_mod_multiple_interpreters,3.12,, macro,Py_mod_name,3.15,, macro,Py_mod_state_clear,3.15,, macro,Py_mod_state_free,3.15,, diff --git a/Misc/stable_abi.toml b/Misc/stable_abi.toml index 5c503f81d3299a..fa0204ee851c63 100644 --- a/Misc/stable_abi.toml +++ b/Misc/stable_abi.toml @@ -1902,6 +1902,10 @@ added = '3.5' [data.PyModuleDef_Type] added = '3.5' +[const.Py_mod_create] + added = '3.5' +[const.Py_mod_exec] + added = '3.5' # New slots in 3.5: # d51374ed78a3e3145911a16cdf3b9b84b3ba7d15 - Matrix multiplication (PEP 465) @@ -2444,6 +2448,9 @@ added = '3.12' [const.Py_TPFLAGS_ITEMS_AT_END] added = '3.12' +[const.Py_mod_multiple_interpreters] + added = '3.12' + [function.PyImport_AddModuleRef] added = '3.13' [function.PyWeakref_GetRef] @@ -2522,6 +2529,8 @@ added = '3.13' [function.PyEval_GetFrameLocals] added = '3.13' +[const.Py_mod_gil] + added = '3.12' [function.Py_TYPE] added = '3.14' From 1c4a0bd96b07ef244f66c760e166072df735764e Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Tue, 25 Nov 2025 11:20:30 +0100 Subject: [PATCH 2/3] Add versionadded entries --- Doc/c-api/module.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Doc/c-api/module.rst b/Doc/c-api/module.rst index 1994a3c7d01ca7..5d91de48d0d8a5 100644 --- a/Doc/c-api/module.rst +++ b/Doc/c-api/module.rst @@ -328,6 +328,8 @@ The available slot types are: ``PyModuleDef`` has non-``NULL`` ``m_traverse``, ``m_clear``, ``m_free``; non-zero ``m_size``; or slots other than ``Py_mod_create``. + .. versionadded:: 3.5 + .. c:macro:: Py_mod_exec Specifies a function that is called to *execute* the module. @@ -342,6 +344,8 @@ The available slot types are: If multiple ``Py_mod_exec`` slots are specified, they are processed in the order they appear in the *m_slots* array. + .. versionadded:: 3.5 + .. c:macro:: Py_mod_multiple_interpreters Specifies one of the following values: From 9c13f77cfe138e61e8223f4317483be18cfba08c Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Tue, 25 Nov 2025 11:20:39 +0100 Subject: [PATCH 3/3] Also add PyModuleDef_Slot --- Doc/data/stable_abi.dat | 1 + Misc/stable_abi.toml | 3 +++ 2 files changed, 4 insertions(+) diff --git a/Doc/data/stable_abi.dat b/Doc/data/stable_abi.dat index 8b59cecb1903cc..b48e2d4de5c426 100644 --- a/Doc/data/stable_abi.dat +++ b/Doc/data/stable_abi.dat @@ -464,6 +464,7 @@ data,PyMethodDescr_Type,3.2,, type,PyModuleDef,3.2,,full-abi type,PyModuleDef_Base,3.2,,full-abi func,PyModuleDef_Init,3.5,, +type,PyModuleDef_Slot,3.5,,full-abi data,PyModuleDef_Type,3.5,, func,PyModule_Add,3.13,, func,PyModule_AddFunctions,3.7,, diff --git a/Misc/stable_abi.toml b/Misc/stable_abi.toml index fa0204ee851c63..231b24d625fe23 100644 --- a/Misc/stable_abi.toml +++ b/Misc/stable_abi.toml @@ -1906,6 +1906,9 @@ added = '3.5' [const.Py_mod_exec] added = '3.5' +[struct.PyModuleDef_Slot] + added = '3.5' + struct_abi_kind = 'full-abi' # New slots in 3.5: # d51374ed78a3e3145911a16cdf3b9b84b3ba7d15 - Matrix multiplication (PEP 465)