[issue30281] set stop default to -PY_SSIZE_T_MAX-1 in PySlice_Unpack

2017-05-10 Thread Xiang Zhang
Changes by Xiang Zhang : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___

[issue30281] set stop default to -PY_SSIZE_T_MAX-1 in PySlice_Unpack

2017-05-10 Thread Xiang Zhang
Xiang Zhang added the comment: New changeset 05469fa1c05acf55bdca05db21822ecdd7f6487a by Xiang Zhang in branch '2.7': bpo-30281: Fix the default value for stop in PySlice_Unpack() (#1531) (#1480) https://github.com/python/cpython/commit/05469fa1c05acf55bdca05db21822ecdd7f6487a --

[issue30281] set stop default to -PY_SSIZE_T_MAX-1 in PySlice_Unpack

2017-05-10 Thread Xiang Zhang
Xiang Zhang added the comment: New changeset 639e295650a51894412c9d976958792010d3bcf8 by Xiang Zhang in branch '3.5': bpo-30281: Fix the default value for stop in PySlice_Unpack() (#1530) (#1480) https://github.com/python/cpython/commit/639e295650a51894412c9d976958792010d3bcf8 --

[issue30281] set stop default to -PY_SSIZE_T_MAX-1 in PySlice_Unpack

2017-05-10 Thread Xiang Zhang
Xiang Zhang added the comment: New changeset 98b49a00d413972965044fd355be3b8482caa07c by Xiang Zhang in branch '3.6': bpo-30281: Fix the default value for stop in PySlice_Unpack() (#1480) (#1529) https://github.com/python/cpython/commit/98b49a00d413972965044fd355be3b8482caa07c --

[issue30281] set stop default to -PY_SSIZE_T_MAX-1 in PySlice_Unpack

2017-05-10 Thread Xiang Zhang
Changes by Xiang Zhang : -- pull_requests: +1630 ___ Python tracker ___ ___

[issue30281] set stop default to -PY_SSIZE_T_MAX-1 in PySlice_Unpack

2017-05-10 Thread Xiang Zhang
Changes by Xiang Zhang : -- pull_requests: +1628 ___ Python tracker ___ ___

[issue30281] set stop default to -PY_SSIZE_T_MAX-1 in PySlice_Unpack

2017-05-10 Thread Xiang Zhang
Changes by Xiang Zhang : -- pull_requests: +1629 ___ Python tracker ___ ___

[issue30281] set stop default to -PY_SSIZE_T_MAX-1 in PySlice_Unpack

2017-05-10 Thread Xiang Zhang
Xiang Zhang added the comment: New changeset 2ddf5a19c3a06978edff2c8ba0aaf5df3528204a by Xiang Zhang in branch 'master': bpo-30281: Fix the default value for stop in PySlice_Unpack() (#1480) https://github.com/python/cpython/commit/2ddf5a19c3a06978edff2c8ba0aaf5df3528204a --

[issue30281] set stop default to -PY_SSIZE_T_MAX-1 in PySlice_Unpack

2017-05-05 Thread Xiang Zhang
Xiang Zhang added the comment: I am okay to use PY_SSIZE_T_MIN. But if we are worried about future change of PY_SSIZE_T_MIN, seems we also need to change the API doc of PySlice_Unpack(). Although _PyEval_SliceIndex's comment says it clips value to -PY_SSIZE_T_MAX-1, actually it uses

[issue30281] set stop default to -PY_SSIZE_T_MAX-1 in PySlice_Unpack

2017-05-05 Thread STINNER Victor
STINNER Victor added the comment: Hum, integer overflows are complex issues. It deserves an unit test, maybe even in C written in _testcapi? -- nosy: +haypo ___ Python tracker

[issue30281] set stop default to -PY_SSIZE_T_MAX-1 in PySlice_Unpack

2017-05-05 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I'm not sure that -PY_SSIZE_T_MAX-1 always is representable. I would use PY_SSIZE_T_MIN and add a static assert (Py_BUILD_ASSERT) that PY_SSIZE_T_MIN + 1 <= -PY_SSIZE_T_MAX. Actually currently PY_SSIZE_T_MIN is -PY_SSIZE_T_MAX-1 by definition, but this can

[issue30281] set stop default to -PY_SSIZE_T_MAX-1 in PySlice_Unpack

2017-05-05 Thread Xiang Zhang
Changes by Xiang Zhang : -- pull_requests: +1579 ___ Python tracker ___ ___

[issue30281] set stop default to -PY_SSIZE_T_MAX-1 in PySlice_Unpack

2017-05-05 Thread Xiang Zhang
New submission from Xiang Zhang: The default value for stop in PySlice_Unpack should be -PY_SSIZE_T_MAX-1. Otherwise a sequence of length PY_SSIZE_T_MAX could get a wrong slicelength when doing L[::-1]. -- components: Interpreter Core messages: 293097 nosy: serhiy.storchaka,