static PyObject *
-gen_throw(PyGenObject *gen, PyObject *const *args, Py_ssize_t nargs)
+gen_throw(PyObject *op, PyObject *const *args, Py_ssize_t nargs)
{
+ PyGenObject *gen = _PyGen_CAST(op);
PyObject *typ;
PyObject *tb = NULL;
PyObject *val = NULL;
};
static PyObject *
-gen_sizeof(PyGenObject *gen, PyObject *Py_UNUSED(ignored))
+gen_sizeof(PyObject *op, PyObject *Py_UNUSED(ignored))
{
+ PyGenObject *gen = _PyGen_CAST(op);
Py_ssize_t res;
res = offsetof(PyGenObject, gi_iframe) + offsetof(_PyInterpreterFrame, localsplus);
PyCodeObject *code = _PyGen_GetCode(gen);
{"send", gen_send, METH_O, send_doc},
{"throw", _PyCFunction_CAST(gen_throw), METH_FASTCALL, throw_doc},
{"close", gen_close, METH_NOARGS, close_doc},
- {"__sizeof__", (PyCFunction)gen_sizeof, METH_NOARGS, sizeof__doc__},
+ {"__sizeof__", gen_sizeof, METH_NOARGS, sizeof__doc__},
{"__class_getitem__", Py_GenericAlias, METH_O|METH_CLASS, PyDoc_STR("See PEP 585")},
{NULL, NULL} /* Sentinel */
};
{"send", gen_send, METH_O, coro_send_doc},
{"throw",_PyCFunction_CAST(gen_throw), METH_FASTCALL, coro_throw_doc},
{"close", gen_close, METH_NOARGS, coro_close_doc},
- {"__sizeof__", (PyCFunction)gen_sizeof, METH_NOARGS, sizeof__doc__},
+ {"__sizeof__", gen_sizeof, METH_NOARGS, sizeof__doc__},
{"__class_getitem__", Py_GenericAlias, METH_O|METH_CLASS, PyDoc_STR("See PEP 585")},
{NULL, NULL} /* Sentinel */
};
coro_wrapper_throw(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
{
PyCoroWrapper *cw = _PyCoroWrapper_CAST(self);
- return gen_throw((PyGenObject *)cw->cw_coroutine, args, nargs);
+ return gen_throw((PyObject*)cw->cw_coroutine, args, nargs);
}
static PyObject *
{"asend", (PyCFunction)async_gen_asend, METH_O, async_asend_doc},
{"athrow",(PyCFunction)async_gen_athrow, METH_VARARGS, async_athrow_doc},
{"aclose", (PyCFunction)async_gen_aclose, METH_NOARGS, async_aclose_doc},
- {"__sizeof__", (PyCFunction)gen_sizeof, METH_NOARGS, sizeof__doc__},
+ {"__sizeof__", gen_sizeof, METH_NOARGS, sizeof__doc__},
{"__class_getitem__", Py_GenericAlias,
METH_O|METH_CLASS, PyDoc_STR("See PEP 585")},
{NULL, NULL} /* Sentinel */
o->ags_gen->ag_running_async = 1;
}
- PyObject *result = gen_throw((PyGenObject*)o->ags_gen, args, nargs);
+ PyObject *result = gen_throw((PyObject*)o->ags_gen, args, nargs);
result = async_gen_unwrap_value(o->ags_gen, result);
if (result == NULL) {
o->agt_gen->ag_running_async = 1;
}
- PyObject *retval = gen_throw((PyGenObject*)o->agt_gen, args, nargs);
+ PyObject *retval = gen_throw((PyObject*)o->agt_gen, args, nargs);
if (o->agt_args) {
retval = async_gen_unwrap_value(o->agt_gen, retval);
if (retval == NULL) {
return (PyObject *)it;
}
static void
-calliter_dealloc(calliterobject *it)
+calliter_dealloc(PyObject *op)
{
+ calliterobject *it = (calliterobject*)op;
_PyObject_GC_UNTRACK(it);
Py_XDECREF(it->it_callable);
Py_XDECREF(it->it_sentinel);
}
static PyObject *
-calliter_iternext(calliterobject *it)
+calliter_iternext(PyObject *op)
{
+ calliterobject *it = (calliterobject*)op;
PyObject *result;
if (it->it_callable == NULL) {
}
static PyObject *
-calliter_reduce(calliterobject *it, PyObject *Py_UNUSED(ignored))
+calliter_reduce(PyObject *op, PyObject *Py_UNUSED(ignored))
{
+ calliterobject *it = (calliterobject*)op;
PyObject *iter = _PyEval_GetBuiltin(&_Py_ID(iter));
/* _PyEval_GetBuiltin can invoke arbitrary code,
}
static PyMethodDef calliter_methods[] = {
- {"__reduce__", (PyCFunction)calliter_reduce, METH_NOARGS, reduce_doc},
+ {"__reduce__", calliter_reduce, METH_NOARGS, reduce_doc},
{NULL, NULL} /* sentinel */
};
sizeof(calliterobject), /* tp_basicsize */
0, /* tp_itemsize */
/* methods */
- (destructor)calliter_dealloc, /* tp_dealloc */
+ calliter_dealloc, /* tp_dealloc */
0, /* tp_vectorcall_offset */
0, /* tp_getattr */
0, /* tp_setattr */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
PyObject_SelfIter, /* tp_iter */
- (iternextfunc)calliter_iternext, /* tp_iternext */
+ calliter_iternext, /* tp_iternext */
calliter_methods, /* tp_methods */
};