8000 non-null main on subinterp test · python/cpython@836f5cf · GitHub
[go: up one dir, main page]

Skip to content

Commit 836f5cf

Browse files
committed
non-null main on subinterp test
1 parent 4c9d200 commit 836f5cf

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Modules/_testmultiphase.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -959,15 +959,18 @@ PyInit__test_shared_gil_only(void)
959959
static int
960960
datetime_capi_exec(PyObject *m)
961961
{
962-
_pydatetimeapi_main = NULL;
962+
int ismain = PyInterpreterState_Get() == PyInterpreterState_Main();
963+
if (ismain) {
964+
_pydatetimeapi_main = NULL;
965+
}
963966
PyDateTime_IMPORT;
964967
if (PyDateTimeAPI == NULL) {
965968
return -1;
966969
}
967970
if (PyDateTimeAPI != PyCapsule_Import(PyDateTime_CAPSULE_NAME, 0)) {
968971
return -1;
969972
}
970-
if (PyInterpreterState_Get() == PyInterpreterState_Main()) {
973+
if (ismain) {
971974
if (PyDateTimeAPI != _pydatetimeapi_main) {
972975
return -1;
973976
}

0 commit comments

Comments
 (0)
0