Skip to content
Closed
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
9 changes: 7 additions & 2 deletions Objects/rangeobject.c
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,6 +3,7 @@
#include "Python.h"
#include "pycore_abstract.h" // _PyIndex_Check()
#include "pycore_ceval.h" // _PyEval_GetBuiltin()
#include "pycore_critical_section.h" // Py_BEGIN_CRITICAL_SECTION()
#include "pycore_long.h" // _PyLong_GetZero()
#include "pycore_modsupport.h" // _PyArg_NoKwnames()
#include "pycore_range.h"
Expand DownExpand Up@@ -813,16 +814,20 @@ PyTypeObject PyRange_Type ={
in the normal case, but possible for any numeric value.
*/


static PyObject *
rangeiter_next(_PyRangeIterObject *r)
{
PyObject *ret = NULL;
Py_BEGIN_CRITICAL_SECTION(r);
if (r->len > 0){
long result = r->start;
r->start = result + r->step;
r->len--;
return PyLong_FromLong(result);
ret = PyLong_FromLong(result);
}
return NULL;
Py_END_CRITICAL_SECTION();
return ret;
}

static PyObject *
Expand Down