Skip to content

Commit b98eba5

Browse files
authored
bpo-43770: _PyTypes_Init() inits _PyAnextAwaitable_Type (GH-25266)
* Rename PyAnextAwaitable_Type to _PyAnextAwaitable_Type. * Expose the type in the internal C API.
1 parent 453074c commit b98eba5

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

Include/iterobject.h

+3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ extern "C" {
77

88
PyAPI_DATA(PyTypeObject) PySeqIter_Type;
99
PyAPI_DATA(PyTypeObject) PyCallIter_Type;
10+
#ifdef Py_BUILD_CORE
11+
extern PyTypeObject _PyAnextAwaitable_Type;
12+
#endif
1013

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

Objects/iterobject.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ static PyAsyncMethods anextawaitable_as_async = {
333333
0, /* am_send */
334334
};
335335

336-
PyTypeObject PyAnextAwaitable_Type = {
336+
PyTypeObject _PyAnextAwaitable_Type = {
337337
PyVarObject_HEAD_INIT(&PyType_Type, 0)
338338
"anext_awaitable", /* tp_name */
339339
sizeof(anextawaitableobject), /* tp_basicsize */
@@ -369,7 +369,7 @@ PyObject *
369369
PyAnextAwaitable_New(PyObject *awaitable, PyObject *default_value)
370370
{
371371
anextawaitableobject *anext = PyObject_GC_New(
372-
anextawaitableobject, &PyAnextAwaitable_Type);
372+
anextawaitableobject, &_PyAnextAwaitable_Type);
373373
if (anext == NULL) {
374374
return NULL;
375375
}

Objects/object.c

+1
Original file line numberDiff line numberDiff line change
@@ -1833,6 +1833,7 @@ _PyTypes_Init(void)
18331833
INIT_TYPE(PyUnicode_Type);
18341834
INIT_TYPE(PyWrapperDescr_Type);
18351835
INIT_TYPE(Py_GenericAliasType);
1836+
INIT_TYPE(_PyAnextAwaitable_Type);
18361837
INIT_TYPE(_PyAsyncGenASend_Type);
18371838
INIT_TYPE(_PyAsyncGenAThrow_Type);
18381839
INIT_TYPE(_PyAsyncGenWrappedValue_Type);

0 commit comments

Comments
 (0)