Skip to content
Closed
Prev Previous commit
Next Next commit
try again 836f5cf
  • Loading branch information
neonene committed Apr 1, 2024
commit b8e545fd29ef6340c2b7de58f227a7a406c40731
7 changes: 6 additions & 1 deletion Modules/_testmultiphase.c
Original file line number Diff line number Diff line change
Expand Up @@ -959,14 +959,19 @@ PyInit__test_shared_gil_only(void)
static int
datetime_capi_exec(PyObject *m)
{
int ismain = PyInterpreterState_Get() == PyInterpreterState_Main();
if (ismain) {
_pydatetimeapi_main = NULL;
}

PyDateTime_IMPORT;
if (PyDateTimeAPI == NULL) {
return -1;
}
if (PyDateTimeAPI != PyCapsule_Import(PyDateTime_CAPSULE_NAME, 0)) {
return -1;
}
if (PyInterpreterState_Get() == PyInterpreterState_Main()) {
if (ismain) {
if (PyDateTimeAPI != _pydatetimeapi_main) {
return -1;
}
Expand Down