Skip to content

Commit d68e3e3

Browse files
committed
ditto (for copy-paste)
1 parent 4e59e88 commit d68e3e3

File tree

6 files changed

+38
-0
lines changed

6 files changed

+38
-0
lines changed

Doc/extending/extending.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,14 @@ with an exception object::
259259

260260
static PyModuleDef_Slot spam_module_slots[] = {
261261
{Py_mod_exec, spam_module_exec},
262+
#ifdef Py_mod_multiple_interpreters
263+
// signal that this module can be imported in isolated subinterpreters
262264
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
265+
#endif
266+
#ifdef Py_mod_gil
267+
// signal that this module supports running without an active GIL
263268
{Py_mod_gil, Py_MOD_GIL_NOT_USED},
269+
#endif
264270
{0, NULL}
265271
};
266272

@@ -829,8 +835,12 @@ Philbrick ([email protected])::
829835
};
830836

831837
static PyModuleDef_Slot keywdarg_slots[] = {
838+
#ifdef Py_mod_multiple_interpreters
832839
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
840+
#endif
841+
#ifdef Py_mod_gil
833842
{Py_mod_gil, Py_MOD_GIL_NOT_USED},
843+
#endif
834844
{0, NULL}
835845
};
836846

@@ -1333,8 +1343,12 @@ function must take care of initializing the C API pointer array::
13331343

13341344
static PyModuleDef_Slot spam_module_slots[] = {
13351345
{Py_mod_exec, spam_module_exec},
1346+
#ifdef Py_mod_multiple_interpreters
13361347
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
1348+
#endif
1349+
#ifdef Py_mod_gil
13371350
{Py_mod_gil, Py_MOD_GIL_NOT_USED},
1351+
#endif
13381352
{0, NULL}
13391353
};
13401354

@@ -1412,8 +1426,12 @@ like this::
14121426

14131427
static PyModuleDef_Slot client_module_slots[] = {
14141428
{Py_mod_exec, client_module_exec},
1429+
#ifdef Py_mod_multiple_interpreters
14151430
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
1431+
#endif
1432+
#ifdef Py_mod_gil
14161433
{Py_mod_gil, Py_MOD_GIL_NOT_USED},
1434+
#endif
14171435
{0, NULL}
14181436
};
14191437

Doc/includes/newtypes/custom.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,13 @@ custom_module_exec(PyObject *mod)
3131

3232
static PyModuleDef_Slot custom_module_slots[] = {
3333
{Py_mod_exec, custom_module_exec},
34+
#ifdef Py_mod_multiple_interpreters
3435
// Py_MOD_PER_INTERPRETER_GIL_SUPPORTED requires heaptypes
3536
{Py_mod_multiple_interpreters, Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED},
37+
#endif
38+
#ifdef Py_mod_gil
3639
{Py_mod_gil, Py_MOD_GIL_NOT_USED},
40+
#endif
3741
{0, NULL}
3842
};
3943

Doc/includes/newtypes/custom2.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,13 @@ custom_module_exec(PyObject *mod)
121121

122122
static PyModuleDef_Slot custom_module_slots[] = {
123123
{Py_mod_exec, custom_module_exec},
124+
#ifdef Py_mod_multiple_interpreters
124125
// Py_MOD_PER_INTERPRETER_GIL_SUPPORTED requires heaptypes
125126
{Py_mod_multiple_interpreters, Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED},
127+
#endif
128+
#ifdef Py_mod_gil
126129
{Py_mod_gil, Py_MOD_GIL_NOT_USED},
130+
#endif
127131
{0, NULL}
128132
};
129133

Doc/includes/newtypes/custom3.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,13 @@ custom_module_exec(PyObject *mod)
166166

167167
static PyModuleDef_Slot custom_module_slots[] = {
168168
{Py_mod_exec, custom_module_exec},
169+
#ifdef Py_mod_multiple_interpreters
169170
// Py_MOD_PER_INTERPRETER_GIL_SUPPORTED requires heaptypes
170171
{Py_mod_multiple_interpreters, Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED},
172+
#endif
173+
#ifdef Py_mod_gil
171174
{Py_mod_gil, Py_MOD_GIL_NOT_USED},
175+
#endif
172176
{0, NULL}
173177
};
174178

Doc/includes/newtypes/custom4.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,9 +185,13 @@ custom_module_exec(PyObject *mod)
185185

186186
static PyModuleDef_Slot custom_module_slots[] = {
187187
{Py_mod_exec, custom_module_exec},
188+
#ifdef Py_mod_multiple_interpreters
188189
// Py_MOD_PER_INTERPRETER_GIL_SUPPORTED requires heaptypes
189190
{Py_mod_multiple_interpreters, Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED},
191+
#endif
192+
#ifdef Py_mod_gil
190193
{Py_mod_gil, Py_MOD_GIL_NOT_USED},
194+
#endif
191195
{0, NULL}
192196
};
193197

Doc/includes/newtypes/sublist.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,13 @@ sublist_module_exec(PyObject *mod)
5757

5858
static PyModuleDef_Slot sublist_module_slots[] = {
5959
{Py_mod_exec, sublist_module_exec},
60+
#ifdef Py_mod_multiple_interpreters
6061
// Py_MOD_PER_INTERPRETER_GIL_SUPPORTED requires heaptypes
6162
{Py_mod_multiple_interpreters, Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED},
63+
#endif
64+
#ifdef Py_mod_gil
6265
{Py_mod_gil, Py_MOD_GIL_NOT_USED},
66+
#endif
6367
{0, NULL}
6468
};
6569

0 commit comments

Comments
 (0)