Skip to content

Commit bd29ce8

Browse files
[3.13] gh-123448: Move _PyNoDefault_Type to the static types array (GH-123449) (#123450)
(cherry picked from commit c9930f5) Co-authored-by: Peter Bierma <[email protected]>
1 parent d379a92 commit bd29ce8

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed
Lines changed: 2 additions & 0 deletions
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.

Modules/_typingmodule.c

Lines changed: 0 additions & 3 deletions
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
}

Objects/object.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2324,6 +2324,7 @@ static PyTypeObject* static_types[] = {
23242324
&_PyWeakref_ProxyType,
23252325
&_PyWeakref_RefType,
23262326
&_PyTypeAlias_Type,
2327+
&_PyNoDefault_Type,
23272328

23282329
// subclasses: _PyTypes_FiniTypes() deallocates them before their base
23292330
// class

0 commit comments

Comments
 (0)