]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-43770: _PyTypes_Init() inits _PyAnextAwaitable_Type (GH-25266)
authorVictor Stinner <vstinner@python.org>
Thu, 8 Apr 2021 07:58:15 +0000 (09:58 +0200)
committerGitHub <noreply@github.com>
Thu, 8 Apr 2021 07:58:15 +0000 (09:58 +0200)
* Rename PyAnextAwaitable_Type to _PyAnextAwaitable_Type.
* Expose the type in the internal C API.

Include/iterobject.h
Objects/iterobject.c
Objects/object.c

index 51139bf1874088965d0f341e442f653a2c5aae0f..6454611aebef8a6cad8b923354318374e03fe26f 100644 (file)
@@ -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)
 
index f0c6b7991768047de5ca56ecb1ff9b71837a699b..65af18abf79deb46a33606c65f79e985d7a0ff4c 100644 (file)
@@ -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;
     }
index ceb0990dbc41a200d3a18a8d2dec9a1aee77240f..1224160dd50c463b25e7c42b25099f3031831099 100644 (file)
@@ -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);