8000 [3.13] gh-123448: Move `_PyNoDefault_Type` to the static types array (GH-123449) by miss-islington · Pull Request #123450 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

[3.13] gh-123448: Move _PyNoDefault_Type to the static types array (GH-123449) #123450

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
8000
Failed to load files.
Loading
Diff view
Diff view
gh-123448: Move _PyNoDefault_Type to the static types array (GH-123449
)

(cherry picked from commit c9930f5)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
  • Loading branch information
ZeroIntensity authored and miss-islington committed Aug 29, 2024
commit 5a00bf81ee82856be1c12484795e0e26186c82b8
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
Loading
0