]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-123448: Move `_PyNoDefault_Type` to the static types array (GH-123449)...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 29 Aug 2024 01:57:28 +0000 (03:57 +0200)
committerGitHub <noreply@github.com>
Thu, 29 Aug 2024 01:57:28 +0000 (18:57 -0700)
(cherry picked from commit c9930f5022f5e7a290896522280e47a1fecba38a)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
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 8799825d8b4ba4d4c2586ecb36167da550796f00..cbf576d5e5aee3af8452491fea674d8002639d47 100644 (file)
@@ -2324,6 +2324,7 @@ static PyTypeObject* static_types[] = {
     &_PyWeakref_ProxyType,
     &_PyWeakref_RefType,
     &_PyTypeAlias_Type,
+    &_PyNoDefault_Type,
 
     // subclasses: _PyTypes_FiniTypes() deallocates them before their base
     // class