summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1997-01-10 17:39:30 (GMT)
committerGuido van Rossum <guido@python.org>1997-01-10 17:39:30 (GMT)
commit80dd9b66727c848658e4b104546e68c323934b2d (patch)
tree8f040d021d5552b7280556a790f0931e297413d2
parent8dc797d1f888b3ebfb1af5fdb97c1a4fc11026cb (diff)
downloadcpython-80dd9b66727c848658e4b104546e68c323934b2d.zip
cpython-80dd9b66727c848658e4b104546e68c323934b2d.tar.gz
cpython-80dd9b66727c848658e4b104546e68c323934b2d.tar.bz2
Subtle change to hex/oct formatting so the largest negative number
does not receive a minus sign.
-rw-r--r--Objects/intobject.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Objects/intobject.c b/Objects/intobject.c
index 3598c90..c4ade84 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);