https://github.com/python/cpython/commit/bd29ce850907e6e1b0c4b99e97b94061fb865fa4 commit: bd29ce850907e6e1b0c4b99e97b94061fb865fa4 branch: 3.13 author: Miss Islington (bot) <[email protected]> committer: JelleZijlstra <[email protected]> date: 2024-08-28T18:57:28-07:00 summary:
[3.13] gh-123448: Move `_PyNoDefault_Type` to the static types array (GH-123449) (#123450) (cherry picked from commit c9930f5022f5e7a290896522280e47a1fecba38a) Co-authored-by: Peter Bierma <[email protected]> files: A Misc/NEWS.d/next/Library/2024-08-28-20-08-19.gh-issue-123448.tItJlp.rst M Modules/_typingmodule.c M 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 index 00000000000000..a57c133d43545f --- /dev/null +++ b/Misc/NEWS.d/next/Library/2024-08-28-20-08-19.gh-issue-123448.tItJlp.rst @@ -0,0 +1,2 @@ +Fixed memory leak of :class:`typing.NoDefault` by moving it to the static types +array. diff --git a/Modules/_typingmodule.c b/Modules/_typingmodule.c index 37af00f3071e1d..09fbb3c5e8b91d 100644 --- a/Modules/_typingmodule.c +++ b/Modules/_typingmodule.c @@ -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; } diff --git a/Objects/object.c b/Objects/object.c index 8799825d8b4ba4..cbf576d5e5aee3 100644 --- a/Objects/object.c +++ b/Objects/object.c @@ -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 _______________________________________________ Python-checkins mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-checkins.python.org/ Member address: [email protected]
