Skip to content

Commit d3d2cfe

Browse files
authored
[3.12] gh-110968: Py_MOD_PER_INTERPRETER_GIL_SUPPORTED was added to 3.12 (#111588)
Constants like Py_MOD_PER_INTERPRETER_GIL_SUPPORTED were only added to the limited C API version 3.12 and newer.
1 parent e255794 commit d3d2cfe

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

Include/moduleobject.h

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,15 @@ struct PyModuleDef_Slot {
8484
#define _Py_mod_LAST_SLOT 3
8585
#endif
8686

87-
/* for Py_mod_multiple_interpreters: */
88-
#define Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED ((void *)0)
89-
#define Py_MOD_MULTIPLE_INTERPRETERS_SUPPORTED ((void *)1)
90-
#define Py_MOD_PER_INTERPRETER_GIL_SUPPORTED ((void *)2)
91-
9287
#endif /* New in 3.5 */
9388

89+
/* for Py_mod_multiple_interpreters: */
90+
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030c0000
91+
# define Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED ((void *)0)
92+
# define Py_MOD_MULTIPLE_INTERPRETERS_SUPPORTED ((void *)1)
93+
# define Py_MOD_PER_INTERPRETER_GIL_SUPPORTED ((void *)2)
94+
#endif
95+
9496
struct PyModuleDef {
9597
PyModuleDef_Base m_base;
9698
const char* m_name;

Modules/xxlimited.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@
6262
pass
6363
*/
6464

65-
#define Py_LIMITED_API 0x030b0000
65+
// Need limited C API version 3.12 for Py_MOD_PER_INTERPRETER_GIL_SUPPORTED
66+
#define Py_LIMITED_API 0x030c0000
6667

6768
#include "Python.h"
6869
#include <string.h>

Modules/xxlimited_35.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,6 @@ xx_modexec(PyObject *m)
293293

294294
static PyModuleDef_Slot xx_slots[] = {
295295
{Py_mod_exec, xx_modexec},
296-
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
297296
{0, NULL}
298297
};
299298

0 commit comments

Comments
 (0)