Mercurial > cpython-lru_cache-weakref
diff Python/compile.c @ 27846:e9d7102f8278 legacy-trunk
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!
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Wed, 12 Feb 2003 16:57:47 +0000 |
| parents | cc01fb654ce3 |
| children | 5f5364ac4adb |
line wrap: on
line diff
--- a/Python/compile.c Wed Feb 12 16:37:00 2003 +0000 +++ b/Python/compile.c Wed Feb 12 16:57:47 2003 +0000 @@ -2069,7 +2069,8 @@ && 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;
