File tree 3 files changed +7
-2
lines changed
Misc/NEWS.d/next/Core and Builtins 3 files changed +7
-2
lines changed Original file line number Diff line number Diff line change
1
+ Fix a minor memory leak at exit: release the memory of the :class: `generic_alias_iterator ` type. Patch by Dong-hee Na.
Original file line number Diff line number Diff line change @@ -683,7 +683,9 @@ ga_iter_clear(PyObject *self) {
683
683
return 0 ;
684
684
}
685
685
686
- static PyTypeObject Py_GenericAliasIterType = {
686
+ // gh-91632: _Py_GenericAliasIterType is exported to be cleared
687
+ // in _PyTypes_FiniTypes.
688
+ PyTypeObject _Py_GenericAliasIterType = {
687
689
PyVarObject_HEAD_INIT (& PyType_Type , 0 )
688
690
.tp_name = "generic_alias_iterator" ,
689
691
.tp_basicsize = sizeof (gaiterobject ),
@@ -697,7 +699,7 @@ static PyTypeObject Py_GenericAliasIterType = {
697
699
698
700
static PyObject *
699
701
ga_iter (PyObject * self ) {
700
- gaiterobject * gi = PyObject_GC_New (gaiterobject , & Py_GenericAliasIterType );
702
+ gaiterobject * gi = PyObject_GC_New (gaiterobject , & _Py_GenericAliasIterType );
701
703
if (gi == NULL ) {
702
704
return NULL ;
703
705
}
Original file line number Diff line number Diff line change @@ -1834,6 +1834,7 @@ _PyTypes_InitState(PyInterpreterState *interp)
1834
1834
#ifdef MS_WINDOWS
1835
1835
extern PyTypeObject PyHKEY_Type ;
1836
1836
#endif
1837
+ extern PyTypeObject _Py_GenericAliasIterType ;
1837
1838
1838
1839
static PyTypeObject * static_types [] = {
1839
1840
// The two most important base types: must be initialized first and
@@ -1923,6 +1924,7 @@ static PyTypeObject* static_types[] = {
1923
1924
& _PyAsyncGenWrappedValue_Type ,
1924
1925
& _PyContextTokenMissing_Type ,
1925
1926
& _PyCoroWrapper_Type ,
1927
+ & _Py_GenericAliasIterType ,
1926
1928
& _PyHamtItems_Type ,
1927
1929
& _PyHamtKeys_Type ,
1928
1930
& _PyHamtValues_Type ,
You can’t perform that action at this time.
0 commit comments