summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1992-08-14 15:13:07 (GMT)
committerGuido van Rossum <guido@python.org>1992-08-14 15:13:07 (GMT)
commit2c475427c26f013cf2050ed281637820abeedc10 (patch)
tree620766abe020c8e89534eb0d1e9fef1270173fe5
parent96caaee8360762683629c4e6c440a2854f89983c (diff)
downloadcpython-2c475427c26f013cf2050ed281637820abeedc10.zip
cpython-2c475427c26f013cf2050ed281637820abeedc10.tar.gz
cpython-2c475427c26f013cf2050ed281637820abeedc10.tar.bz2
oct(0) should return '0', not '00'
-rw-r--r--Objects/longobject.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/Objects/longobject.c b/Objects/longobject.c
index f9e3765..7ede30c 100644
--- a/Objects/longobject.c
+++ b/Objects/longobject.c
@@ -322,8 +322,10 @@ long_format(aa, base)
})
} while (ABS(a->ob_size) != 0);
DECREF(a);
- if (base == 8)
- *--p = '0';
+ if (base == 8) {
+ if (size_a != 0)
+ *--p = '0';
+ }
else if (base == 16) {
*--p = 'x';
*--p = '0';