Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fix Py_DECREF
  • Loading branch information
mcognetta committed Aug 11, 2023
commit 2a0b4a369d4af4be9acb0a6b70b96f0dfea5dfe2
24 changes: 12 additions & 12 deletions Python/bltinmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -2494,7 +2494,7 @@ static PyObject* range_sum_fastpath(PyObject* module, PyObject *range)
PyObject* length = builtin_len(module, range);

if (PyObject_RichCompareBool(length, PyLong_FromLong(0), Py_EQ)) {
Py_DecRef(length);
Py_DECREF(length);
return PyLong_FromLong(0);
}

Expand Down Expand Up @@ -2523,17 +2523,17 @@ static PyObject* range_sum_fastpath(PyObject* module, PyObject *range)

PyObject* result = PyNumber_Add(d, e);

Py_DecRef(length);
Py_DecRef(start);
Py_DecRef(step);
Py_DECREF(length);
Py_DECREF(start);
Py_DECREF(step);

Py_DecRef(one);
Py_DecRef(a);
Py_DecRef(b);
Py_DecRef(two);
Py_DecRef(c);
Py_DecRef(d);
Py_DecRef(e);
Py_DECREF(one);
Py_DECREF(a);
Py_DECREF(b);
Py_DECREF(two);
Py_DECREF(c);
Py_DECREF(d);
Py_DECREF(e);

return result;
}
Expand All @@ -2551,7 +2551,7 @@ builtin_sum_impl(PyObject *module, PyObject *iterable, PyObject *start)
}
PyObject* rangesum = range_sum_fastpath(module, iterable);
result = PyNumber_Add(result, rangesum);
Py_DecRef(rangesum);
Py_DECREF(rangesum);
return result;
}

Expand Down