diff options
author | Thomas Wouters <thomas@python.org> | 2001-06-27 14:26:58 (GMT) |
---|---|---|
committer | Thomas Wouters <thomas@python.org> | 2001-06-27 14:26:58 (GMT) |
commit | b24ffe47ae516d4620df3d7ce32d2108fc398d18 (patch) | |
tree | 9b90a6b82ba3f5252105b5e9c5765631642d0eed | |
parent | 7383e7a19cf471fa592f04db4be22844ba65d309 (diff) | |
download | cpython-b24ffe47ae516d4620df3d7ce32d2108fc398d18.zip cpython-b24ffe47ae516d4620df3d7ce32d2108fc398d18.tar.gz cpython-b24ffe47ae516d4620df3d7ce32d2108fc398d18.tar.bz2 |
Backport of Tim's checkin 1.35:
SF bug 434186: 0x80000000/2 != 0x80000000>>1
i_divmod: New and simpler algorithm. Old one returned gibberish on most
boxes when the numerator was -sys.maxint-1. Oddly enough, it worked in the
release (not debug) build on Windows, because the compiler optimized away
some tricky sign manipulations that were incorrect in this case.
Makes you wonder <wink> ...
-rw-r--r-- | Lib/test/test_b1.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_b1.py b/Lib/test/test_b1.py index ea09d0b..e2cc49b 100644 --- a/Lib/test/test_b1.py +++ b/Lib/test/test_b1.py @@ -367,6 +367,13 @@ except ValueError: else: raise TestFailed, "int(%s)" % `s[1:]` + " should raise ValueError" +# SF bug 434186: 0x80000000/2 != 0x80000000>>1. +# Worked by accident in Windows release build, but failed in debug build. +# Failed in all Linux builds. +x = -1-sys.maxint +if x >> 1 != x/2: + raise TestFailed("x >> 1 != x/2 when x == -1-sys.maxint") + print 'isinstance' class C: pass |