We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5c58e72 commit 8a81393Copy full SHA for 8a81393
Objects/rangeobject.c
@@ -813,16 +813,21 @@ PyTypeObject PyRange_Type = {
813
in the normal case, but possible for any numeric value.
814
*/
815
816
+#include "pycore_critical_section.h"// Py_BEGIN_CRITICAL_SECTION()
817
+
818
static PyObject *
819
rangeiter_next(_PyRangeIterObject *r)
820
{
821
+ PyObject *ret = NULL;
822
+ Py_BEGIN_CRITICAL_SECTION(r);
823
if (r->len > 0) {
824
long result = r->start;
825
r->start = result + r->step;
826
r->len--;
- return PyLong_FromLong(result);
827
+ ret = PyLong_FromLong(result);
828
}
- return NULL;
829
+ Py_END_CRITICAL_SECTION();
830
+ return ret;
831
832
833
0 commit comments