Skip to content

Commit 8973de5

Browse files
Issue python#27867: Silenced may-be-used-uninitialized warnings after
using PySlice_GetIndicesEx() in debug builds.
2 parents 09f939d + ed4de13 commit 8973de5

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Include/sliceobject.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,9 @@ PyAPI_FUNC(int) PySlice_GetIndicesEx(PyObject *r, Py_ssize_t length,
4646

4747
#if !defined(Py_LIMITED_API) || (Py_LIMITED_API+0 >= 0x03050400 && Py_LIMITED_API+0 < 0x03060000) || Py_LIMITED_API+0 >= 0x03060100
4848
#define PySlice_GetIndicesEx(slice, length, start, stop, step, slicelen) ( \
49-
PySlice_Unpack((slice), (start), (stop), (step)) < 0 ? -1 : \
50-
((*slicelen = PySlice_AdjustIndices((length), (start), (stop), *(step))), \
49+
PySlice_Unpack((slice), (start), (stop), (step)) < 0 ? \
50+
((*(slicelen) = 0), -1) : \
51+
((*(slicelen) = PySlice_AdjustIndices((length), (start), (stop), *(step))), \
5152
0))
5253
PyAPI_FUNC(int) PySlice_Unpack(PyObject *slice,
5354
Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step);

0 commit comments

Comments
 (0)