gh-119333: Add C api to have contextvar enter/exit callbacks (#119335)

Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
This commit is contained in:
Jason Fried 2024-09-23 20:40:17 -07:00 committed by GitHub
parent ad7c778546
commit d87482bc4e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 402 additions and 0 deletions

View file

@ -906,6 +906,11 @@ interpreter_clear(PyInterpreterState *interp, PyThreadState *tstate)
interp->code_watchers[i] = NULL;
}
interp->active_code_watchers = 0;
for (int i=0; i < CONTEXT_MAX_WATCHERS; i++) {
interp->context_watchers[i] = NULL;
}
interp->active_context_watchers = 0;
// XXX Once we have one allocator per interpreter (i.e.
// per-interpreter GC) we must ensure that all of the interpreter's
// objects have been cleaned up at the point.