From: Guido van Rossum Date: Fri, 10 Jan 1997 17:39:30 +0000 (+0000) Subject: Subtle change to hex/oct formatting so the largest negative number X-Git-Tag: v1.5a1~550 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=80dd9b66727c848658e4b104546e68c323934b2d;p=python Subtle change to hex/oct formatting so the largest negative number does not receive a minus sign. --- diff --git a/Objects/intobject.c b/Objects/intobject.c index 3598c90e8e..c4ade847fd 100644 --- a/Objects/intobject.c +++ b/Objects/intobject.c @@ -725,7 +725,7 @@ int_oct(v) long x = v -> ob_ival; if (x == 0) strcpy(buf, "0"); - else if (x > 0) + else if (-x < 0) sprintf(buf, "0%lo", x); else sprintf(buf, "-0%lo", -x); @@ -738,7 +738,7 @@ int_hex(v) { char buf[20]; long x = v -> ob_ival; - if (x >= 0) + if (-x <= 0) sprintf(buf, "0x%lx", x); else sprintf(buf, "-0x%lx", -x);