Skip to content

Commit e99a90b

Browse files
Check the result of adding the pending call (for releasing XID).
1 parent 466c0d9 commit e99a90b

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

Python/pystate.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1309,7 +1309,7 @@ _PyCrossInterpreterData_Release(_PyCrossInterpreterData *data)
13091309
return;
13101310
}
13111311

1312-
// Switch to the original interpreter.
1312+
// Get the original interpreter.
13131313
PyInterpreterState *interp = _PyInterpreterState_LookUpID(data->interp);
13141314
if (interp == NULL) {
13151315
// The intepreter was already destroyed.
@@ -1318,9 +1318,16 @@ _PyCrossInterpreterData_Release(_PyCrossInterpreterData *data)
13181318
}
13191319
return;
13201320
}
1321+
// XXX There's a slight race here...
1322+
if (interp->finalizing) {
1323+
// XXX Someone leaked some memory...
1324+
return;
1325+
}
13211326

13221327
// "Release" the data and/or the object.
1323-
_Py_AddPendingCall(interp, 0, _release_xidata, data);
1328+
if (_Py_AddPendingCall(interp, 0, _release_xidata, data) != 0) {
1329+
// XXX Queue full or couldn't get lock. Try again somehow?
1330+
}
13241331
}
13251332

13261333
PyObject *

0 commit comments

Comments
 (0)