8000 gh-91632: Fix generic_alias_iterator to be finalized at exit. by corona10 · Pull Request #91727 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-91632: Fix generic_alias_iterator to be finalized at exit. #91727

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 5 commits into from
Apr 20, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fix Py_GenericAliasIterType to be finalized at exit.
  • Loading branch information
corona10 committed Apr 20, 2022
commit cdd6a5879531613d3a693a1b2e1b975b498f98e5
16 changes: 16 additions & 0 deletions Include/internal/pycore_genericaliasobject.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#ifndef Py_INTERNAL_GENERICALIASOBJECT_H
#define Py_INTERNAL_GENERICALIASOBJECT_H
#ifdef __cplusplus
extern "C" {
#endif

#ifndef Py_BUILD_CORE
# error "this header requires Py_BUILD_CORE define"
#endif

extern PyTypeObject _Py_GenericAliasIterType;

#ifdef __cplusplus
}
#endif
#endif /* !Py_INTERNAL_GENERICALIASOBJECT_H */
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix :class:`generic_alias_iterator` to be finalized at exit.
4 changes: 2 additions & 2 deletions Objects/genericaliasobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,7 @@ ga_iter_clear(PyObject *self) {
return 0;
}

static PyTypeObject Py_GenericAliasIterType = {
PyTypeObject _Py_GenericAliasIterType = {
PyVarObject_HEAD_INIT(&PyType_Type, 0)
.tp_name = "generic_alias_iterator",
.tp_basicsize = sizeof(gaiterobject),
Expand All @@ -697,7 +697,7 @@ static PyTypeObject Py_GenericAliasIterType = {

static PyObject *
ga_iter(PyObject *self) {
gaiterobject *gi = PyObject_GC_New(gaiterobject, &Py_GenericAliasIterType);
gaiterobject *gi = PyObject_GC_New(gaiterobject, &_Py_GenericAliasIterType);
if (gi == NULL) {
return NULL;
}
Expand Down
2 changes: 2 additions & 0 deletions Objects/object.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "pycore_unionobject.h" // _PyUnion_Type
#include "frameobject.h" // PyFrame_Type
#include "pycore_interpreteridobject.h" // _PyInterpreterID_Type
#include "pycore_genericaliasobject.h" // _Py_GenericAliasIterType

#ifdef Py_LIMITED_API
// Prevent recursive call _Py_IncRef() <=> Py_INCREF()
Expand Down Expand Up @@ -1923,6 +1924,7 @@ static PyTypeObject* static_types[] = {
&_PyAsyncGenWrappedValue_Type,
&_PyContextTokenMissing_Type,
&_PyCoroWrapper_Type,
&_Py_GenericAliasIterType,
&_PyHamtItems_Type,
&_PyHamtKeys_Type,
&_PyHamtValues_Type,
Expand Down
0