From: Thomas Wouters Date: Wed, 27 Jun 2001 14:26:58 +0000 (+0000) Subject: Backport of Tim's checkin 1.35: X-Git-Tag: v2.1.1c1~42 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b24ffe47ae516d4620df3d7ce32d2108fc398d18;p=thirdparty%2FPython%2Fcpython.git 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 ... --- diff --git a/Lib/test/test_b1.py b/Lib/test/test_b1.py index ea09d0be8ce0..e2cc49b16ab0 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