msg292888 - (view) |
Author: STINNER Victor (vstinner) *  |
Date: 2017-05-03 11:06 |
./python -m test -v test_xml_etree ... test_getslice_negative_steps (test.test_xml_etree.ElementSlicingTest) ... python: Objects/sliceobject.c:176: _PySlice_AdjustIndices: Assertion `step >= -PY_SSIZE_T_MAX' failed. ... Traceback (most recent call first): File "/home/haypo/prog/python/2.7/Lib/xml/etree/ElementTree.py", line 266, in __getitem__ return self._children[index] File "/home/haypo/prog/python/2.7/Lib/test/test_xml_etree.py", line 2305, in test_getslice_negative_steps self.assertEqual(self._elem_tags(e[3::-sys.maxsize-1]), ['a3']) See issues: bpo-30074, bpo-27867. |
|
|
msg292894 - (view) |
Author: STINNER Victor (vstinner) *  |
Date: 2017-05-03 12:26 |
Attached PR fixes test_xml_etree. |
|
|
msg292898 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) *  |
Date: 2017-05-03 12:51 |
Thank you Victor for noticing and fixing this crash! |
|
|
msg292901 - (view) |
Author: STINNER Victor (vstinner) *  |
Date: 2017-05-03 14:00 |
New changeset f6a3133972378205baaa6a854d46170d04a2db67 by Victor Stinner in branch '2.7': bpo-30255: Clip step in _PySlice_Unpack() (#1429) https://github.com/python/cpython/commit/f6a3133972378205baaa6a854d46170d04a2db67 |
|
|
msg292902 - (view) |
Author: STINNER Victor (vstinner) *  |
Date: 2017-05-03 14:03 |
I pushed the change to try to fix buildbots, but I'm not sure that it's complete. The change announces "... clip the step to [-PY_SSIZE_T_MAX, PY_SSIZE_T_MAX] ...", but there is no explicit to clip the maximum to PY_SSIZE_T_MAX. Maybe there is a bug on this side too! The code should be reviewed one more time. |
|
|
msg292903 - (view) |
Author: STINNER Victor (vstinner) *  |
Date: 2017-05-03 14:05 |
> Thank you Victor for noticing and fixing this crash! Something is *very* strange: we have +20 buildbots, but I didn't see this assertion failure on any buildbot. Instead, I noticed that regrtest runs less tests than announced: see issue #30254. It's very strange because I expect either a crash: regrtest stops with no more output, or a report of the crash. But no, regrtest displays the summary as everything was fine... |
|
|
msg293036 - (view) |
Author: STINNER Victor (vstinner) *  |
Date: 2017-05-05 01:49 |
> It's very strange because I expect either a crash: regrtest stops with no more output, or a report of the crash. But no, regrtest displays the summary as everything was fine... It was a bug in regrtest: now fixed by bpo-30258. |
|
|
msg293075 - (view) |
Author: STINNER Victor (vstinner) *  |
Date: 2017-05-05 08:26 |
> The change announces "... clip the step to [-PY_SSIZE_T_MAX, PY_SSIZE_T_MAX] ...", but there is no explicit to clip the maximum to PY_SSIZE_T_MAX. Maybe there is a bug on this side too! The code should be reviewed one more time. Ok, I checked: _PySlice_Unpack() uses _PyEval_SliceIndex() to convert the step Python object into a C Py_ssize_t, so the code is already correct: it does "clip the step to [-PY_SSIZE_T_MAX, PY_SSIZE_T_MAX]" as announced ;-) I close the issue. Thanks Serhiy for your work on fixing corner cases related to slices ;-) |
|
|