]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-123448: Move `_PyNoDefault_Type` to the static types array (#123449)
authorPeter Bierma <zintensitydev@gmail.com>
Thu, 29 Aug 2024 01:27:40 +0000 (21:27 -0400)
committerGitHub <noreply@github.com>
Thu, 29 Aug 2024 01:27:40 +0000 (18:27 -0700)
Misc/NEWS.d/next/Library/2024-08-28-20-08-19.gh-issue-123448.tItJlp.rst [new file with mode: 0644]
Modules/_typingmodule.c
Objects/object.c

diff --git a/Misc/NEWS.d/next/Library/2024-08-28-20-08-19.gh-issue-123448.tItJlp.rst b/Misc/NEWS.d/next/Library/2024-08-28-20-08-19.gh-issue-123448.tItJlp.rst
new file mode 100644 (file)
index 0000000..a57c133
--- /dev/null
@@ -0,0 +1,2 @@
+Fixed memory leak of :class:`typing.NoDefault` by moving it to the static types
+array.
index 37af00f3071e1d51627f859d4f6bb40484097596..09fbb3c5e8b91d790a6e7a0c29195f919a6b865e 100644 (file)
@@ -63,9 +63,6 @@ _typing_exec(PyObject *m)
     if (PyModule_AddObjectRef(m, "TypeAliasType", (PyObject *)&_PyTypeAlias_Type) < 0) {
         return -1;
     }
-    if (PyType_Ready(&_PyNoDefault_Type) < 0) {
-        return -1;
-    }
     if (PyModule_AddObjectRef(m, "NoDefault", (PyObject *)&_Py_NoDefaultStruct) < 0) {
         return -1;
     }
index 97403227625971a6829bbe6ea724778e8733ed4b..4b8b6c29266812874b8b8d91b23e907fdd4f78b2 100644 (file)
@@ -2347,6 +2347,7 @@ static PyTypeObject* static_types[] = {
     &_PyWeakref_ProxyType,
     &_PyWeakref_RefType,
     &_PyTypeAlias_Type,
+    &_PyNoDefault_Type,
 
     // subclasses: _PyTypes_FiniTypes() deallocates them before their base
     // class