summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2001-06-18 19:21:11 (GMT)
committerTim Peters <tim.peters@gmail.com>2001-06-18 19:21:11 (GMT)
commit1dad6a86de55c38da5c356c2c6d81be8ff7884b1 (patch)
tree963ebc4365437512ddaf162bb67b8da40cb05190 /Lib
parent888aa2681925cb14adda8a85dbf96e848ecdac40 (diff)
downloadcpython-1dad6a86de55c38da5c356c2c6d81be8ff7884b1.zip
cpython-1dad6a86de55c38da5c356c2c6d81be8ff7884b1.tar.gz
cpython-1dad6a86de55c38da5c356c2c6d81be8ff7884b1.tar.bz2
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> ... Bugfix candidate.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_b1.py7
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