Skip to content

bpo-43770: _PyTypes_Init() inits _PyAnextAwaitable_Type #25266

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
Apr 8, 2021
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
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Include/iterobject.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ extern "C" {

PyAPI_DATA(PyTypeObject) PySeqIter_Type;
PyAPI_DATA(PyTypeObject) PyCallIter_Type;
#ifdef Py_BUILD_CORE
extern PyTypeObject _PyAnextAwaitable_Type;
#endif
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be moved inside _PyTypes_Init(). I tried to mimick other header files which defines all types.


#define PySeqIter_Check(op) Py_IS_TYPE(op, &PySeqIter_Type)

Expand Down
4 changes: 2 additions & 2 deletions Objects/iterobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ static PyAsyncMethods anextawaitable_as_async = {
0, /* am_send */
};

PyTypeObject PyAnextAwaitable_Type = {
PyTypeObject _PyAnextAwaitable_Type = {
PyVarObject_HEAD_INIT(&PyType_Type, 0)
"anext_awaitable", /* tp_name */
sizeof(anextawaitableobject), /* tp_basicsize */
Expand Down Expand Up @@ -369,7 +369,7 @@ PyObject *
PyAnextAwaitable_New(PyObject *awaitable, PyObject *default_value)
{
anextawaitableobject *anext = PyObject_GC_New(
anextawaitableobject, &PyAnextAwaitable_Type);
anextawaitableobject, &_PyAnextAwaitable_Type);
if (anext == NULL) {
return NULL;
}
Expand Down
1 change: 1 addition & 0 deletions Objects/object.c
Original file line number Diff line number Diff line change
Expand Up @@ -1833,6 +1833,7 @@ _PyTypes_Init(void)
INIT_TYPE(PyUnicode_Type);
INIT_TYPE(PyWrapperDescr_Type);
INIT_TYPE(Py_GenericAliasType);
INIT_TYPE(_PyAnextAwaitable_Type);
INIT_TYPE(_PyAsyncGenASend_Type);
INIT_TYPE(_PyAsyncGenAThrow_Type);
INIT_TYPE(_PyAsyncGenWrappedValue_Type);
Expand Down