mirror of
https://github.com/python/cpython.git
synced 2025-12-15 21:44:50 +00:00
bpo-31709: Drop support for asynchronous __aiter__. (#3903)
This commit is contained in:
parent
86566702f3
commit
faa135acbf
9 changed files with 47 additions and 300 deletions
|
|
@ -1141,100 +1141,6 @@ PyCoro_New(PyFrameObject *f, PyObject *name, PyObject *qualname)
|
|||
}
|
||||
|
||||
|
||||
/* __aiter__ wrapper; see http://bugs.python.org/issue27243 for details. */
|
||||
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
PyObject *ags_aiter;
|
||||
} PyAIterWrapper;
|
||||
|
||||
|
||||
static PyObject *
|
||||
aiter_wrapper_iternext(PyAIterWrapper *aw)
|
||||
{
|
||||
_PyGen_SetStopIterationValue(aw->ags_aiter);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int
|
||||
aiter_wrapper_traverse(PyAIterWrapper *aw, visitproc visit, void *arg)
|
||||
{
|
||||
Py_VISIT((PyObject *)aw->ags_aiter);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
aiter_wrapper_dealloc(PyAIterWrapper *aw)
|
||||
{
|
||||
_PyObject_GC_UNTRACK((PyObject *)aw);
|
||||
Py_CLEAR(aw->ags_aiter);
|
||||
PyObject_GC_Del(aw);
|
||||
}
|
||||
|
||||
static PyAsyncMethods aiter_wrapper_as_async = {
|
||||
PyObject_SelfIter, /* am_await */
|
||||
0, /* am_aiter */
|
||||
0 /* am_anext */
|
||||
};
|
||||
|
||||
PyTypeObject _PyAIterWrapper_Type = {
|
||||
PyVarObject_HEAD_INIT(&PyType_Type, 0)
|
||||
"aiter_wrapper",
|
||||
sizeof(PyAIterWrapper), /* tp_basicsize */
|
||||
0, /* tp_itemsize */
|
||||
(destructor)aiter_wrapper_dealloc, /* destructor tp_dealloc */
|
||||
0, /* tp_print */
|
||||
0, /* tp_getattr */
|
||||
0, /* tp_setattr */
|
||||
&aiter_wrapper_as_async, /* tp_as_async */
|
||||
0, /* tp_repr */
|
||||
0, /* tp_as_number */
|
||||
0, /* tp_as_sequence */
|
||||
0, /* tp_as_mapping */
|
||||
0, /* tp_hash */
|
||||
0, /* tp_call */
|
||||
0, /* tp_str */
|
||||
PyObject_GenericGetAttr, /* tp_getattro */
|
||||
0, /* tp_setattro */
|
||||
0, /* tp_as_buffer */
|
||||
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags */
|
||||
"A wrapper object for __aiter__ bakwards compatibility.",
|
||||
(traverseproc)aiter_wrapper_traverse, /* tp_traverse */
|
||||
0, /* tp_clear */
|
||||
0, /* tp_richcompare */
|
||||
0, /* tp_weaklistoffset */
|
||||
PyObject_SelfIter, /* tp_iter */
|
||||
(iternextfunc)aiter_wrapper_iternext, /* tp_iternext */
|
||||
0, /* tp_methods */
|
||||
0, /* tp_members */
|
||||
0, /* tp_getset */
|
||||
0, /* tp_base */
|
||||
0, /* tp_dict */
|
||||
0, /* tp_descr_get */
|
||||
0, /* tp_descr_set */
|
||||
0, /* tp_dictoffset */
|
||||
0, /* tp_init */
|
||||
0, /* tp_alloc */
|
||||
0, /* tp_new */
|
||||
0, /* tp_free */
|
||||
};
|
||||
|
||||
|
||||
PyObject *
|
||||
_PyAIterWrapper_New(PyObject *aiter)
|
||||
{
|
||||
PyAIterWrapper *aw = PyObject_GC_New(PyAIterWrapper,
|
||||
&_PyAIterWrapper_Type);
|
||||
if (aw == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
Py_INCREF(aiter);
|
||||
aw->ags_aiter = aiter;
|
||||
_PyObject_GC_TRACK(aw);
|
||||
return (PyObject *)aw;
|
||||
}
|
||||
|
||||
|
||||
/* ========= Asynchronous Generators ========= */
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue