[issue27145] long_add and long_sub might return a new int where _ints[x] could be returned

2019-11-26 Thread STINNER Victor
STINNER Victor added the comment: It seems like there are a few corner cases where long integers are not normalized: https://github.com/python/cpython/pull/15716#pullrequestreview-298002027 But the initial issue described here has been fixed, so it's better to keep this issue closed. If

[issue27145] long_add and long_sub might return a new int where _ints[x] could be returned

2019-11-25 Thread Inada Naoki
Change by Inada Naoki : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___ ___

[issue27145] long_add and long_sub might return a new int where _ints[x] could be returned

2019-11-25 Thread Inada Naoki
Inada Naoki added the comment: New changeset 036fe85bd3e6cd01093d836d71792a1966f961e8 by Inada Naoki (HongWeipeng) in branch 'master': bpo-27145: small_ints[x] could be returned in long_add and long_sub (GH-15716)

[issue27145] long_add and long_sub might return a new int where _ints[x] could be returned

2019-09-06 Thread hongweipeng
Change by hongweipeng : -- pull_requests: +15370 pull_request: https://github.com/python/cpython/pull/15716 ___ Python tracker ___

[issue27145] long_add and long_sub might return a new int where _ints[x] could be returned

2016-06-03 Thread Oren Milman
Oren Milman added the comment: After giving it some more thought, I feel somewhat uncertain about that check for a failure after using _PyLong_Negate. At first I noticed that after every call to _PyLong_Negate there is such a check. But then I realized that in my patch, and also in long_mul

[issue27145] long_add and long_sub might return a new int where _ints[x] could be returned

2016-06-03 Thread Oren Milman
Oren Milman added the comment: I just realized I had forgotten to check for a failure after using _PyLong_Negate. The updated diff file is attached. -- Added file: http://bugs.python.org/file43148/proposedPatches.diff ___ Python tracker

[issue27145] long_add and long_sub might return a new int where _ints[x] could be returned

2016-05-31 Thread STINNER Victor
Changes by STINNER Victor : -- nosy: +yselivanov ___ Python tracker ___ ___

[issue27145] long_add and long_sub might return a new int where _ints[x] could be returned

2016-05-31 Thread SilentGhost
Changes by SilentGhost : -- nosy: +haypo, rhettinger stage: -> patch review versions: +Python 3.6 ___ Python tracker ___

[issue27145] long_add and long_sub might return a new int where _ints[x] could be returned

2016-05-28 Thread Oren Milman
Changes by Oren Milman : Added file: http://bugs.python.org/file43043/patchedCPythonTestOutput.txt ___ Python tracker ___

[issue27145] long_add and long_sub might return a new int where _ints[x] could be returned

2016-05-28 Thread Oren Milman
Changes by Oren Milman : Added file: http://bugs.python.org/file43042/CPythonTestOutput.txt ___ Python tracker ___

[issue27145] long_add and long_sub might return a new int where _ints[x] could be returned

2016-05-28 Thread Oren Milman
New submission from Oren Milman: the current state >>> if is32BitCPython: ... PyLong_SHIFT = 15 ... elif is64BitCPython: ... PyLong_SHIFT = 30 ... >>> # case A # >>> a = 2 ** PyLong_SHIFT - 1 >>> b = 2 ** PyLong_SHIFT - 2 >>> a - b 1 >>> a - b is 1 True >>>