summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2022-01-21 12:06:34 (GMT)
committerGitHub <noreply@github.com>2022-01-21 12:06:34 (GMT)
commit595225e86dcc6ea520a584839925a878dce7a9b2 (patch)
tree177f9801d750c91f61ae40b99b9dcf8b0e9c135d /Python
parentea38e436fe1e585fb8c1f0badf5482f525b7f9ff (diff)
downloadcpython-595225e86dcc6ea520a584839925a878dce7a9b2.zip
cpython-595225e86dcc6ea520a584839925a878dce7a9b2.tar.gz
cpython-595225e86dcc6ea520a584839925a878dce7a9b2.tar.bz2
bpo-46417: Py_Finalize() clears static types (GH-30743)
Add _PyTypes_FiniTypes() best-effort function to clear static types: don't deallocate a type if it still has subclasses. remove_subclass() now sets tp_subclasses to NULL when removing the last subclass.
Diffstat (limited to 'Python')
-rw-r--r--Python/pylifecycle.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c
index 5572f61..662e578 100644
--- a/Python/pylifecycle.c
+++ b/Python/pylifecycle.c
@@ -1676,6 +1676,7 @@ finalize_interp_types(PyInterpreterState *interp)
_PyThread_FiniType(interp);
_PyErr_FiniTypes(interp);
_PyTypes_Fini(interp);
+ _PyTypes_FiniTypes(interp);
// Call _PyUnicode_ClearInterned() before _PyDict_Fini() since it uses
// a dict internally.