File tree Expand file tree Collapse file tree 3 files changed +7
-2
lines changed
Misc/NEWS.d/next/Core and Builtins Expand file tree Collapse file tree 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) {
683683 return 0 ;
684684}
685685
686- static PyTypeObject Py_GenericAliasIterType = {
686+ // gh-91632: _Py_GenericAliasIterType is exported to be cleared
687+ // in _PyTypes_FiniTypes.
688+ PyTypeObject _Py_GenericAliasIterType = {
687689 PyVarObject_HEAD_INIT (& PyType_Type , 0 )
688690 .tp_name = "generic_alias_iterator" ,
689691 .tp_basicsize = sizeof (gaiterobject ),
@@ -697,7 +699,7 @@ static PyTypeObject Py_GenericAliasIterType = {
697699
698700static PyObject *
699701ga_iter (PyObject * self ) {
700- gaiterobject * gi = PyObject_GC_New (gaiterobject , & Py_GenericAliasIterType );
702+ gaiterobject * gi = PyObject_GC_New (gaiterobject , & _Py_GenericAliasIterType );
701703 if (gi == NULL ) {
702704 return NULL ;
703705 }
Original file line number Diff line number Diff line change @@ -1834,6 +1834,7 @@ _PyTypes_InitState(PyInterpreterState *interp)
18341834#ifdef MS_WINDOWS
18351835extern PyTypeObject PyHKEY_Type ;
18361836#endif
1837+ extern PyTypeObject _Py_GenericAliasIterType ;
18371838
18381839static PyTypeObject * static_types [] = {
18391840 // The two most important base types: must be initialized first and
@@ -1923,6 +1924,7 @@ static PyTypeObject* static_types[] = {
19231924 & _PyAsyncGenWrappedValue_Type ,
19241925 & _PyContextTokenMissing_Type ,
19251926 & _PyCoroWrapper_Type ,
1927+ & _Py_GenericAliasIterType ,
19261928 & _PyHamtItems_Type ,
19271929 & _PyHamtKeys_Type ,
19281930 & _PyHamtValues_Type ,
You can’t perform that action at this time.
0 commit comments