mirror of https://github.com/python/cpython
[3.13] gh-123448: Move `_PyNoDefault_Type` to the static types array (GH-123449) (#123450)
(cherry picked from commit c9930f5022
)
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
This commit is contained in:
parent
d379a92ddc
commit
bd29ce8509
|
@ -0,0 +1,2 @@
|
||||||
|
Fixed memory leak of :class:`typing.NoDefault` by moving it to the static types
|
||||||
|
array.
|
|
@ -63,9 +63,6 @@ _typing_exec(PyObject *m)
|
||||||
if (PyModule_AddObjectRef(m, "TypeAliasType", (PyObject *)&_PyTypeAlias_Type) < 0) {
|
if (PyModule_AddObjectRef(m, "TypeAliasType", (PyObject *)&_PyTypeAlias_Type) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (PyType_Ready(&_PyNoDefault_Type) < 0) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (PyModule_AddObjectRef(m, "NoDefault", (PyObject *)&_Py_NoDefaultStruct) < 0) {
|
if (PyModule_AddObjectRef(m, "NoDefault", (PyObject *)&_Py_NoDefaultStruct) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2324,6 +2324,7 @@ static PyTypeObject* static_types[] = {
|
||||||
&_PyWeakref_ProxyType,
|
&_PyWeakref_ProxyType,
|
||||||
&_PyWeakref_RefType,
|
&_PyWeakref_RefType,
|
||||||
&_PyTypeAlias_Type,
|
&_PyTypeAlias_Type,
|
||||||
|
&_PyNoDefault_Type,
|
||||||
|
|
||||||
// subclasses: _PyTypes_FiniTypes() deallocates them before their base
|
// subclasses: _PyTypes_FiniTypes() deallocates them before their base
|
||||||
// class
|
// class
|
||||||
|
|
Loading…
Reference in New Issue