Skip to content

Commit

Permalink
[3.12] gh-110310: Add a Per-Interpreter XID Registry for Heap Types (g…
Browse files Browse the repository at this point in the history
…h-110311) (gh-110714)

We do the following:

* add a per-interpreter XID registry (PyInterpreterState.xidregistry)
* put heap types there (keep static types in _PyRuntimeState.xidregistry)
* clear the registries during interpreter/runtime finalization
* avoid duplicate entries in the registry (when _PyCrossInterpreterData_RegisterClass() is called more than once for a type)
* use Py_TYPE() instead of PyObject_Type() in _PyCrossInterpreterData_Lookup()

The per-interpreter registry helps preserve isolation between interpreters.  This is important when heap types are registered, which is something we haven't been doing yet but I will likely do soon.

(cherry-picked from commit 80dc39e)
  • Loading branch information
ericsnowcurrently authored Nov 28, 2023
1 parent 0122b4d commit 1e1a30f
Show file tree
Hide file tree
Showing 4 changed files with 506 additions and 405 deletions.
Loading

0 comments on commit 1e1a30f

Please sign in to comment.