GH-91054: Add code object watchers API (GH-99859)

* Add API to allow extensions to set callback function on creation and destruction of PyCodeObject

Co-authored-by: Ye11ow-Flash <janshah@cs.stonybrook.edu>
This commit is contained in:
Itamar Ostricher 2022-12-02 09:28:27 -08:00 committed by GitHub
parent 0563be23a5
commit 3c137dc613
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 364 additions and 0 deletions

View file

@ -466,6 +466,11 @@ interpreter_clear(PyInterpreterState *interp, PyThreadState *tstate)
}
interp->active_func_watchers = 0;
for (int i=0; i < CODE_MAX_WATCHERS; i++) {
interp->code_watchers[i] = NULL;
}
interp->active_code_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.