8000 gh-99741: Fix the Cross-Interpreter Data API by ericsnowcurrently · Pull Request #99939 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-99741: Fix the Cross-Interpreter Data API #99939

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
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Clear cross-interpreter data after releasing it.
  • Loading branch information
ericsnowcurrently committed Dec 1, 2022
commit ce4e158790a3b5885664bc25e368c46fcf915211
5 changes: 4 additions & 1 deletion Python/pystate.c
Original file line number Diff line number Diff line change
Expand Up @@ -1873,8 +1873,9 @@ _release_xidata(void *arg)
_PyCrossInterpreterData *data = (_PyCrossInterpreterData *)arg;
if (data->free != NULL) {
data->free(data->data);
data->data = NULL;
}
Py_XDECREF(data->obj);
Py_CLEAR(data->obj);
}

static void
Expand All @@ -1894,6 +1895,8 @@ _call_in_interpreter(struct _gilstate_runtime_state *gilstate,
save_tstate = _PyThreadState_Swap(gilstate, tstate);
}

// XXX Once the GIL is per-interpreter, this should be called with the
// calling interpreter's GIL released and the target interpreter's held.
func(arg);

// Switch back.
Expand Down
0