summaryrefslogtreecommitdiff
path: root/Objects/sliceobject.c
diff options
context:
space:
mode:
Diffstat (limited to 'Objects/sliceobject.c')
-rw-r--r--Objects/sliceobject.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/Objects/sliceobject.c b/Objects/sliceobject.c
index d41ac105f6..ebc44642fe 100644
--- a/Objects/sliceobject.c
+++ b/Objects/sliceobject.c
@@ -374,9 +374,8 @@ _PySlice_GetLongIndices(PySliceObject *self, PyObject *length,
/* Convert step to an integer; raise for zero step. */
if (self->step == Py_None) {
- step = PyLong_FromLong(1L);
- if (step == NULL)
- goto error;
+ step = _PyLong_One;
+ Py_INCREF(step);
step_is_negative = 0;
}
else {
@@ -404,10 +403,8 @@ _PySlice_GetLongIndices(PySliceObject *self, PyObject *length,
goto error;
}
else {
- lower = PyLong_FromLong(0L);
- if (lower == NULL)
- goto error;
-
+ lower = _PyLong_Zero;
+ Py_INCREF(lower);
upper = length;
Py_INCREF(upper);
}