From: Victor Stinner Date: Thu, 8 Apr 2021 07:58:15 +0000 (+0200) Subject: bpo-43770: _PyTypes_Init() inits _PyAnextAwaitable_Type (GH-25266) X-Git-Tag: v3.10.0b1~365 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b98eba5bc2ffbe7a0ed49d540ebc4f756ae61985;p=thirdparty%2FPython%2Fcpython.git bpo-43770: _PyTypes_Init() inits _PyAnextAwaitable_Type (GH-25266) * Rename PyAnextAwaitable_Type to _PyAnextAwaitable_Type. * Expose the type in the internal C API. --- diff --git a/Include/iterobject.h b/Include/iterobject.h index 51139bf18740..6454611aebef 100644 --- a/Include/iterobject.h +++ b/Include/iterobject.h @@ -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 #define PySeqIter_Check(op) Py_IS_TYPE(op, &PySeqIter_Type) diff --git a/Objects/iterobject.c b/Objects/iterobject.c index f0c6b7991768..65af18abf79d 100644 --- a/Objects/iterobject.c +++ b/Objects/iterobject.c @@ -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 */ @@ -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; } diff --git a/Objects/object.c b/Objects/object.c index ceb0990dbc41..1224160dd50c 100644 --- a/Objects/object.c +++ b/Objects/object.c @@ -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);