0
0
mirror of https://github.com/python/cpython.git synced 2024-11-21 12:59:38 +01:00

gh-123448: Move _PyNoDefault_Type to the static types array (#123449)

This commit is contained in:
Peter Bierma 2024-08-28 21:27:40 -04:00 committed by GitHub
parent b379f1b26c
commit c9930f5022
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 3 additions and 3 deletions

View File

@ -0,0 +1,2 @@
Fixed memory leak of :class:`typing.NoDefault` by moving it to the static types
array.

View 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;
}

View 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