Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
gh-111178: Fix function signatures for test_iter
  • Loading branch information
vstinner committed Mar 19, 2025
commit c6add98b6337804a7ff9e73f9d28ab1b3faf9b81
3 changes: 2 additions & 1 deletion Modules/_io/bufferedio.c
Original file line number Diff line number Diff line change
Expand Up @@ -1524,8 +1524,9 @@ buffered_iternext(PyObject *op)
}

static PyObject *
buffered_repr(buffered *self)
buffered_repr(PyObject *op)
{
buffered *self = buffered_CAST(op);
PyObject *nameobj, *res;

if (PyObject_GetOptionalAttr((PyObject *) self, &_Py_ID(name), &nameobj) < 0) {
Expand Down
3 changes: 2 additions & 1 deletion Modules/_sre/sre.c
Original file line number Diff line number Diff line change
Expand Up @@ -2710,8 +2710,9 @@ match_regs_get(PyObject *op, void *Py_UNUSED(ignored))
}

static PyObject *
match_repr(MatchObject *self)
match_repr(PyObject *op)
{
MatchObject *self = _MatchObject_CAST(op);
PyObject *result;
PyObject *group0 = match_getslice_by_index(self, 0, Py_None);
if (group0 == NULL)
Expand Down
22 changes: 14 additions & 8 deletions Objects/genericaliasobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -885,7 +885,9 @@ static PyNumberMethods ga_as_number = {
};

static PyObject *
ga_iternext(gaiterobject *gi) {
ga_iternext(PyObject *op)
{
gaiterobject *gi = (gaiterobject*)op;
if (gi->obj == NULL) {
PyErr_SetNone(PyExc_StopIteration);
return NULL;
Expand All @@ -901,21 +903,25 @@ ga_iternext(gaiterobject *gi) {
}

static void
ga_iter_dealloc(gaiterobject *gi) {
ga_iter_dealloc(PyObject *op)
{
gaiterobject *gi = (gaiterobject*)op;
PyObject_GC_UnTrack(gi);
Py_XDECREF(gi->obj);
PyObject_GC_Del(gi);
}

static int
ga_iter_traverse(gaiterobject *gi, visitproc visit, void *arg)
ga_iter_traverse(PyObject *op, visitproc visit, void *arg)
{
gaiterobject *gi = (gaiterobject*)op;
Py_VISIT(gi->obj);
return 0;
}

static int
ga_iter_clear(PyObject *self) {
ga_iter_clear(PyObject *self)
{
gaiterobject *gi = (gaiterobject *)self;
Py_CLEAR(gi->obj);
return 0;
Expand Down Expand Up @@ -949,11 +955,11 @@ PyTypeObject _Py_GenericAliasIterType = {
.tp_name = "generic_alias_iterator",
.tp_basicsize = sizeof(gaiterobject),
.tp_iter = PyObject_SelfIter,
.tp_iternext = (iternextfunc)ga_iternext,
.tp_traverse = (traverseproc)ga_iter_traverse,
.tp_iternext = ga_iternext,
.tp_traverse = ga_iter_traverse,
.tp_methods = ga_iter_methods,
.tp_dealloc = (destructor)ga_iter_dealloc,
.tp_clear = (inquiry)ga_iter_clear,
.tp_dealloc = ga_iter_dealloc,
.tp_clear = ga_iter_clear,
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
};

Expand Down
5 changes: 3 additions & 2 deletions Objects/iterobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,9 @@ calliter_dealloc(PyObject *op)
}

static int
calliter_traverse(calliterobject *it, visitproc visit, void *arg)
calliter_traverse(PyObject *op, visitproc visit, void *arg)
{
calliterobject *it = (calliterobject*)op;
Py_VISIT(it->it_callable);
Py_VISIT(it->it_sentinel);
return 0;
Expand Down Expand Up @@ -294,7 +295,7 @@ PyTypeObject PyCallIter_Type = {
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags */
0, /* tp_doc */
(traverseproc)calliter_traverse, /* tp_traverse */
calliter_traverse, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
Expand Down
Loading