diff options
author | Guido van Rossum <guido@python.org> | 2003-02-12 16:57:47 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2003-02-12 16:57:47 (GMT) |
commit | 66b1259dbc2cf4aaefd779d76c4a83fe8003bafd (patch) | |
tree | fb23dcbbc51fa40a706479b01aa5de3a11f61314 /Lib/test/test_compile.py | |
parent | e71b9f830b0a3829de799c6b826ea2b4450762c4 (diff) | |
download | cpython-66b1259dbc2cf4aaefd779d76c4a83fe8003bafd.zip cpython-66b1259dbc2cf4aaefd779d76c4a83fe8003bafd.tar.gz cpython-66b1259dbc2cf4aaefd779d76c4a83fe8003bafd.tar.bz2 |
SF #660455 : patch by NNorwitz.
"Unsigned" (i.e., positive-looking, but really negative) hex/oct
constants with a leading minus sign are once again properly negated.
The micro-optimization for negated numeric constants did the wrong
thing for such hex/oct constants. The patch avoids the optimization
for all hex/oct constants.
This needs to be backported to Python 2.2!
Diffstat (limited to 'Lib/test/test_compile.py')
-rw-r--r-- | Lib/test/test_compile.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/Lib/test/test_compile.py b/Lib/test/test_compile.py index 4b522ac..1fe7f52 100644 --- a/Lib/test/test_compile.py +++ b/Lib/test/test_compile.py @@ -133,9 +133,12 @@ expect_same("000000000000007", 7) expect_same("000000000000008.", 8.) expect_same("000000000000009.", 9.) -## # Verify treatment of unary minus on negative numbers SF bug #660455 -## import warnings -## warnings.filterwarnings("ignore", "hex/oct constants", FutureWarning) -## # XXX Of course the following test will have to be changed in Python 2.4 -## expect_same("0xffffffff", -1) -## expect_same("-0xffffffff", 1) +# Verify treatment of unary minus on negative numbers SF bug #660455 +import warnings +warnings.filterwarnings("ignore", "hex/oct constants", FutureWarning) +# XXX Of course the following test will have to be changed in Python 2.4 +# This test is in a <string> so the filterwarnings() can affect it +exec """ +expect_same("0xffffffff", -1) +expect_same("-0xffffffff", 1) +""" |