Skip to content

Commit cfdfbb4

Browse files
Issue #27342: Replaced some Py_XDECREFs with Py_DECREFs.
Patch by Xiang Zhang.
1 parent 75a2586 commit cfdfbb4

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

Objects/rangeobject.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,9 @@ range_new(PyTypeObject *type, PyObject *args, PyObject *kw)
129129
return (PyObject *) obj;
130130

131131
/* Failed to create object, release attributes */
132-
Py_XDECREF(start);
133-
Py_XDECREF(stop);
134-
Py_XDECREF(step);
132+
Py_DECREF(start);
133+
Py_DECREF(stop);
134+
Py_DECREF(step);
135135
return NULL;
136136
}
137137

@@ -196,7 +196,7 @@ compute_range_length(PyObject *start, PyObject *stop, PyObject *step)
196196
/* if (lo >= hi), return length of 0. */
197197
cmp_result = PyObject_RichCompareBool(lo, hi, Py_GE);
198198
if (cmp_result != 0) {
199-
Py_XDECREF(step);
199+
Py_DECREF(step);
200200
if (cmp_result < 0)
201201
return NULL;
202202
return PyLong_FromLong(0);
@@ -225,9 +225,9 @@ compute_range_length(PyObject *start, PyObject *stop, PyObject *step)
225225
return result;
226226

227227
Fail:
228+
Py_DECREF(step);
228229
Py_XDECREF(tmp2);
229230
Py_XDECREF(diff);
230-
Py_XDECREF(step);
231231
Py_XDECREF(tmp1);
232232
Py_XDECREF(one);
233233
return NULL;

Python/bltinmodule.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -2711,10 +2711,10 @@ _PyBuiltin_Init(void)
27112711
SETBUILTIN("zip", &PyZip_Type);
27122712
debug = PyBool_FromLong(Py_OptimizeFlag == 0);
27132713
if (PyDict_SetItemString(dict, "__debug__", debug) < 0) {
2714-
Py_XDECREF(debug);
2714+
Py_DECREF(debug);
27152715
return NULL;
27162716
}
2717-
Py_XDECREF(debug);
2717+
Py_DECREF(debug);
27182718

27192719
return mod;
27202720
#undef ADD_TO_ALL

0 commit comments

Comments
 (0)