Skip to content

Commit efa0540

Browse files
committed
Move iter call in unicodeiter_reduce before it pointer access due to potential side effects
1 parent 71960a8 commit efa0540

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Diff for: Objects/unicodeobject.c

+4-3
Original file line numberDiff line numberDiff line change
@@ -14784,14 +14784,15 @@ PyDoc_STRVAR(length_hint_doc, "Private method returning an estimate of len(list(
1478414784
static PyObject *
1478514785
unicodeiter_reduce(unicodeiterobject *it, PyObject *Py_UNUSED(ignored))
1478614786
{
14787+
PyObject *iter = _PyEval_GetBuiltin(&_Py_ID(iter));
14788+
1478714789
if (it->it_seq != NULL) {
14788-
return Py_BuildValue("N(O)n", _PyEval_GetBuiltin(&_Py_ID(iter)),
14789-
it->it_seq, it->it_index);
14790+
return Py_BuildValue("N(O)n", iter, it->it_seq, it->it_index);
1479014791
} else {
1479114792
PyObject *u = unicode_new_empty();
1479214793
if (u == NULL)
1479314794
return NULL;
14794-
return Py_BuildValue("N(N)", _PyEval_GetBuiltin(&_Py_ID(iter)), u);
14795+
return Py_BuildValue("N(N)", iter, u);
1479514796
}
1479614797
}
1479714798

0 commit comments

Comments
 (0)