Skip to content

Commit d51862b

Browse files
committed
Make FutureIter_close use Py_CLEAR directly
This just gets rid of any confusion about why FutureIter_clear is using a critical section
1 parent 241b9de commit d51862b

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

‎Modules/_asynciomodule.c‎

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1954,21 +1954,22 @@ FutureIter_throw(PyObject *op, PyObject *const *args, Py_ssize_t nargs)
19541954
return NULL;
19551955
}
19561956

1957-
static int
1958-
FutureIter_clear(PyObject *op)
1957+
static PyObject *
1958+
FutureIter_close(PyObject *self, PyObject *arg)
19591959
{
1960-
futureiterobject *it = (futureiterobject*)op;
1961-
Py_BEGIN_CRITICAL_SECTION(op);
1960+
futureiterobject *it = (futureiterobject*)self;
1961+
Py_BEGIN_CRITICAL_SECTION(self);
19621962
Py_CLEAR(it->future);
19631963
Py_END_CRITICAL_SECTION();
1964-
return 0;
1964+
Py_RETURN_NONE;
19651965
}
19661966

1967-
static PyObject *
1968-
FutureIter_close(PyObject *self, PyObject *arg)
1967+
static int
1968+
FutureIter_clear(PyObject *op)
19691969
{
1970-
(void)FutureIter_clear(self);
1971-
Py_RETURN_NONE;
1970+
futureiterobject *it = (futureiterobject*)op;
1971+
Py_CLEAR(it->future);
1972+
return 0;
19721973
}
19731974

19741975
static int

0 commit comments

Comments
 (0)