gh-117398: Use Per-Interpreter State for the _datetime Static Types (gh-119929)

We make use of the same mechanism that we use for the static builtin types.  This required a few tweaks.

The relevant code could use some cleanup but I opted to avoid the significant churn in this change.  I'll tackle that separately.

This change is the final piece needed to make _datetime support multiple interpreters.  I've updated the module slot accordingly.
This commit is contained in:
Eric Snow 2024-06-03 19:09:18 -04:00 committed by GitHub
parent dba7a167db
commit 105f22ea46
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 384 additions and 169 deletions

View file

@ -3725,7 +3725,7 @@ _PyExc_FiniTypes(PyInterpreterState *interp)
{
for (Py_ssize_t i=Py_ARRAY_LENGTH(static_exceptions) - 1; i >= 0; i--) {
PyTypeObject *exc = static_exceptions[i].exc;
_PyStaticType_Dealloc(interp, exc);
_PyStaticType_FiniBuiltin(interp, exc);
}
}