Skip to content

Commit

Permalink
[3.13] gh-123448: Move _PyNoDefault_Type to the static types array (G…
Browse files Browse the repository at this point in the history
…H-123449) (#123450)

(cherry picked from commit c9930f5)

Co-authored-by: Peter Bierma <[email protected]>
  • Loading branch information
miss-islington and ZeroIntensity authored Aug 29, 2024
1 parent d379a92 commit bd29ce8
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fixed memory leak of :class:`typing.NoDefault` by moving it to the static types
array.
3 changes: 0 additions & 3 deletions Modules/_typingmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
1 change: 1 addition & 0 deletions Objects/object.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit bd29ce8

Please sign in to comment.