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 /Python/compile.c | |
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 'Python/compile.c')
-rw-r--r-- | Python/compile.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Python/compile.c b/Python/compile.c index 2b2a9d5..717b3ff 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -2069,7 +2069,8 @@ com_factor(struct compiling *c, node *n) && NCH(ppower) == 1 && TYPE((patom = CHILD(ppower, 0))) == atom && TYPE((pnum = CHILD(patom, 0))) == NUMBER - && !(childtype == MINUS && is_float_zero(STR(pnum)))) { + && !(childtype == MINUS && + (STR(pnum)[0] == '0' || is_float_zero(STR(pnum))))) { if (childtype == TILDE) { com_invert_constant(c, pnum); return; |