Skip to content

Commit 60a669c

Browse files
committed
Make test.test_importlib and _testmultiphase importable in subinterpreters
1 parent 13faf0f commit 60a669c

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

Lib/test/test_importlib/util.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
import tempfile
1616
import types
1717

18-
_testsinglephase = import_helper.import_module("_testsinglephase")
18+
# gh-116303: Skip test module dependent tests if test modules are unavailable
19+
import_helper.import_module("_testmultiphase")
1920

2021

2122
BUILTINS = types.SimpleNamespace()

Modules/_testmultiphase.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1024,6 +1024,8 @@ PyModExport__test_from_modexport(void)
10241024
{
10251025
static PyModuleDef_Slot slots[] = {
10261026
{Py_mod_name, "_test_from_modexport"},
1027+
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
1028+
{Py_mod_gil, Py_MOD_GIL_NOT_USED},
10271029
{0},
10281030
};
10291031
return slots;
@@ -1073,6 +1075,8 @@ PyModExport__test_from_modexport_create_nonmodule(void)
10731075
static PyModuleDef_Slot slots[] = {
10741076
{Py_mod_name, "_test_from_modexport_create_nonmodule"},
10751077
{Py_mod_create, modexport_create_string},
1078+
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
1079+
{Py_mod_gil, Py_MOD_GIL_NOT_USED},
10761080
{0},
10771081
};
10781082
return slots;
@@ -1165,6 +1169,8 @@ PyModExport__test_from_modexport_smoke(void)
11651169
{Py_mod_methods, methods},
11661170
{Py_mod_state_free, modexport_smoke_free},
11671171
{Py_mod_token, (void*)&modexport_smoke_test_token},
1172+
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
1173+
{Py_mod_gil, Py_MOD_GIL_NOT_USED},
11681174
{0},
11691175
};
11701176
return slots;

0 commit comments

Comments
 (0)