@@ -681,6 +681,27 @@ PyInit__testmultiphase_export_unreported_exception(void)
681
681
return PyModuleDef_Init (& main_def );
682
682
}
683
683
684
+ static PyObject *
685
+ createfunc_noop (PyObject * spec , PyModuleDef * def )
686
+ {
687
+ return PyModule_New ("spam" );
688
+ }
689
+
690
+ static PyModuleDef_Slot slots_multiple_create_slots [] = {
691
+ {Py_mod_create , createfunc_noop },
692
+ {Py_mod_create , createfunc_noop },
693
+ {0 , NULL },
694
+ };
695
+
696
+ static PyModuleDef def_multiple_create_slots = TEST_MODULE_DEF (
697
+ "_testmultiphase_multiple_create_slots" , slots_multiple_create_slots , NULL );
698
+
699
+ PyMODINIT_FUNC
700
+ PyInit__testmultiphase_multiple_create_slots (void )
701
+ {
702
+ return PyModuleDef_Init (& def_multiple_create_slots );
703
+ }
704
+
684
705
static PyObject *
685
706
createfunc_null (PyObject * spec , PyModuleDef * def )
686
707
{
@@ -892,7 +913,24 @@ PyInit__test_module_state_shared(void)
892
913
}
893
914
894
915
895
- /* multiple interpreters supports */
916
+ /* multiple interpreters support */
917
+
918
+ static PyModuleDef_Slot slots_multiple_multiple_interpreters_slots [] = {
919
+ {Py_mod_multiple_interpreters , Py_MOD_PER_INTERPRETER_GIL_SUPPORTED },
920
+ {Py_mod_multiple_interpreters , Py_MOD_PER_INTERPRETER_GIL_SUPPORTED },
921
+ {0 , NULL },
922
+ };
923
+
924
+ static PyModuleDef def_multiple_multiple_interpreters_slots = TEST_MODULE_DEF (
925
+ "_testmultiphase_multiple_multiple_interpreters_slots" ,
926
+ slots_multiple_multiple_interpreters_slots ,
927
+ NULL );
928
+
929
+ PyMODINIT_FUNC
930
+ PyInit__testmultiphase_multiple_multiple_interpreters_slots (void )
931
+ {
932
+ return PyModuleDef_Init (& def_multiple_multiple_interpreters_slots );
933
+ }
896
934
897
935
static PyModuleDef_Slot non_isolated_slots [] = {
898
936
{Py_mod_exec , execfunc },
@@ -909,3 +947,23 @@ PyInit__test_non_isolated(void)
909
947
{
910
948
return PyModuleDef_Init (& non_isolated_def );
911
949
}
950
+
951
+
952
+ static PyModuleDef_Slot shared_gil_only_slots [] = {
953
+ {Py_mod_exec , execfunc },
954
+ /* Note that Py_MOD_MULTIPLE_INTERPRETERS_SUPPORTED is the default.
955
+ We put it here explicitly to draw attention to the contrast
956
+ with Py_MOD_PER_INTERPRETER_GIL_SUPPORTED. */
957
+ {Py_mod_multiple_interpreters , Py_MOD_MULTIPLE_INTERPRETERS_SUPPORTED },
958
+ {0 , NULL },
959
+ };
960
+
961
+ static PyModuleDef shared_gil_only_def = TEST_MODULE_DEF ("_test_shared_gil_only" ,
962
+ shared_gil_only_slots ,
963
+ testexport_methods );
964
+
965
+ PyMODINIT_FUNC
966
+ PyInit__test_shared_gil_only (void )
967
+ {
968
+ return PyModuleDef_Init (& shared_gil_only_def );
969
+ }
0 commit comments