8000 gh-76785: Use Pending Calls When Releasing Cross-Interpreter Data by ericsnowcurrently · Pull Request #109556 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-76785: Use Pending Calls When Releasing Cross-Interpreter Data #109556

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Sep 19, 2023
Merged
Prev Previous commit
Next Next commit
Pass a flag to _release_xid_data().
  • Loading branch information
ericsnowcurrently committed Sep 9, 2023
commit 53e102912576e847e7d1135fee4636fd66b8937c
9 changes: 6 additions & 3 deletions Modules/_xxinterpchannelsmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,12 @@ add_new_type(PyObject *mod, PyType_Spec *spec, crossinterpdatafunc shared)
return cls;
}

#define XID_IGNORE_EXC 1

static int
_release_xid_data(_PyCrossInterpreterData *data, int ignoreexc)
_release_xid_data(_PyCrossInterpreterData *data, int flags)
{
int ignoreexc = flags & XID_IGNORE_EXC;
PyObject *exc;
if (ignoreexc) {
exc = PyErr_GetRaisedException();
Expand Down Expand Up @@ -366,7 +369,7 @@ static void
_channelitem_clear(_channelitem *item)
{
if (item->data != NULL) {
(void)_release_xid_data(item->data, 1);
(void)_release_xid_data(item->data, XID_IGNORE_EXC);
// It was allocated in _channel_send().
GLOBAL_FREE(item->data);
item->data = NULL;
Expand Down Expand Up @@ -1439,7 +1442,7 @@ _channel_recv(_channels *channels, int64_t id, PyObject **res)
PyObject *obj = _PyCrossInterpreterData_NewObject(data);
if (obj == NULL) {
assert(PyErr_Occurred());
(void)_release_xid_data(data, 1);
(void)_release_xid_data(data, XID_IGNORE_EXC);
// It was allocated in _channel_send().
GLOBAL_FREE(data);
return -1;
Expand Down
0