summaryrefslogtreecommitdiffstats
path: root/Modules/_io/_iomodule.c
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2023-05-02 01:36:00 (GMT)
committerGitHub <noreply@github.com>2023-05-02 01:36:00 (GMT)
commitfdd878650d325297cd801305bc2d1b0e903e42b4 (patch)
tree9814f09627ef014852dcc3fa462dfec30e5e591d /Modules/_io/_iomodule.c
parentb1ca34d4d5e463b8108eea20090f12292390f0cf (diff)
downloadcpython-fdd878650d325297cd801305bc2d1b0e903e42b4.zip
cpython-fdd878650d325297cd801305bc2d1b0e903e42b4.tar.gz
cpython-fdd878650d325297cd801305bc2d1b0e903e42b4.tar.bz2
gh-94673: Properly Initialize and Finalize Static Builtin Types for Each Interpreter (gh-104072)
Until now, we haven't been initializing nor finalizing the per-interpreter state properly.
Diffstat (limited to 'Modules/_io/_iomodule.c')
-rw-r--r--Modules/_io/_iomodule.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/Modules/_io/_iomodule.c b/Modules/_io/_iomodule.c
index a3bfbc9..8ec3a60 100644
--- a/Modules/_io/_iomodule.c
+++ b/Modules/_io/_iomodule.c
@@ -680,7 +680,7 @@ _PyIO_InitTypes(PyInterpreterState *interp)
for (size_t i=0; i < Py_ARRAY_LENGTH(static_types); i++) {
PyTypeObject *type = static_types[i];
- if (_PyStaticType_InitBuiltin(type) < 0) {
+ if (_PyStaticType_InitBuiltin(interp, type) < 0) {
return _PyStatus_ERR("Can't initialize builtin type");
}
}
@@ -691,15 +691,11 @@ _PyIO_InitTypes(PyInterpreterState *interp)
void
_PyIO_FiniTypes(PyInterpreterState *interp)
{
- if (!_Py_IsMainInterpreter(interp)) {
- return;
- }
-
// Deallocate types in the reverse order to deallocate subclasses before
// their base classes.
for (Py_ssize_t i=Py_ARRAY_LENGTH(static_types) - 1; i >= 0; i--) {
PyTypeObject *type = static_types[i];
- _PyStaticType_Dealloc(type);
+ _PyStaticType_Dealloc(interp, type);
}
}