Issue #20440: Applied yet one patch for using Py_SETREF.
The patch is automatically generated, it replaces the code that uses Py_CLEAR.
diff --git a/Objects/rangeobject.c b/Objects/rangeobject.c
index f858cd2..45656d2 100644
--- a/Objects/rangeobject.c
+++ b/Objects/rangeobject.c
@@ -1001,8 +1001,7 @@
return NULL;
cmp = PyObject_RichCompareBool(state, zero, Py_LT);
if (cmp > 0) {
- Py_CLEAR(r->index);
- r->index = zero;
+ Py_SETREF(r->index, zero);
Py_RETURN_NONE;
}
Py_DECREF(zero);
@@ -1015,9 +1014,8 @@
if (cmp > 0)
state = r->len;
- Py_CLEAR(r->index);
- r->index = state;
- Py_INCREF(r->index);
+ Py_INCREF(state);
+ Py_SETREF(r->index, state);
Py_RETURN_NONE;
}