Skip to content

Commit c9930f5

Browse files
gh-123448: Move _PyNoDefault_Type to the static types array (#123449)
1 parent b379f1b commit c9930f5

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fixed memory leak of :class:`typing.NoDefault` by moving it to the static types
2+
array.

Diff for: Modules/_typingmodule.c

-3
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,6 @@ _typing_exec(PyObject *m)
6363
if (PyModule_AddObjectRef(m, "TypeAliasType", (PyObject *)&_PyTypeAlias_Type) < 0) {
6464
return -1;
6565
}
66-
if (PyType_Ready(&_PyNoDefault_Type) < 0) {
67-
return -1;
68-
}
6966
if (PyModule_AddObjectRef(m, "NoDefault", (PyObject *)&_Py_NoDefaultStruct) < 0) {
7067
return -1;
7168
}

Diff for: Objects/object.c

+1
Original file line numberDiff line numberDiff line change
@@ -2347,6 +2347,7 @@ static PyTypeObject* static_types[] = {
23472347
&_PyWeakref_ProxyType,
23482348
&_PyWeakref_RefType,
23492349
&_PyTypeAlias_Type,
2350+
&_PyNoDefault_Type,
23502351

23512352
// subclasses: _PyTypes_FiniTypes() deallocates them before their base
23522353
// class

0 commit comments

Comments
 (0)