Skip to content

Commit

Permalink
fix exit of critical section
Browse files Browse the repository at this point in the history
  • Loading branch information
eendebakpt committed Oct 20, 2024
1 parent e42f74f commit 079e6ab
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Objects/enumobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -275,12 +275,14 @@ enum_next(enumobject *en)
static PyObject *
enum_reduce(enumobject *en, PyObject *Py_UNUSED(ignored))
{
PyObject * result;
Py_BEGIN_CRITICAL_SECTION(en);
if (en->en_longindex != NULL)
return Py_BuildValue("O(OO)", Py_TYPE(en), en->en_sit, en->en_longindex);
result = Py_BuildValue("O(OO)", Py_TYPE(en), en->en_sit, en->en_longindex);
else
return Py_BuildValue("O(On)", Py_TYPE(en), en->en_sit, en->en_index);
result = Py_BuildValue("O(On)", Py_TYPE(en), en->en_sit, en->en_index);
Py_END_CRITICAL_SECTION();
return result;
}

PyDoc_STRVAR(reduce_doc, "Return state information for pickling.");
Expand Down

0 comments on commit 079e6ab

Please sign in to comment.