This is a complement to PR 13375.
a[:] = data
self.assertEqual(list(it), [])
+ def test_step_overflow(self):
+ a = [0, 1, 2, 3, 4]
+ a[1::sys.maxsize] = [0]
+ self.assertEqual(a[3::sys.maxsize], [3])
+
def test_no_comdat_folding(self):
# Issue 8847: In the PGO build, the MSVC linker's COMDAT folding
# optimization causes failures in code that relies on distinct
--- /dev/null
+Fix possible signed integer overflow when handling slices. Patch by hongweipeng.
PyObject *np;
StgDictObject *stgdict, *itemdict;
PyObject *proto;
- Py_ssize_t i, len, cur;
+ Py_ssize_t i, len;
+ size_t cur;
/* Since pointers have no length, and we want to apply
different semantics to negative indices than normal
return list_item(self, i);
}
else if (PySlice_Check(item)) {
- Py_ssize_t start, stop, step, slicelength, cur, i;
+ Py_ssize_t start, stop, step, slicelength, i;
+ size_t cur;
PyObject* result;
PyObject* it;
PyObject **src, **dest;
/* assign slice */
PyObject *ins, *seq;
PyObject **garbage, **seqitems, **selfitems;
- Py_ssize_t cur, i;
+ Py_ssize_t i;
+ size_t cur;
/* protect against a[::-1] = a */
if (self == (PyListObject*)value) {