From 66b1259dbc2cf4aaefd779d76c4a83fe8003bafd Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Wed, 12 Feb 2003 16:57:47 +0000 Subject: 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! --- Python/compile.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Python/compile.c') diff --git a/Python/compile.c b/Python/compile.c index 2b2a9d5389..717b3ffe1e 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; -- cgit v1.2.1