summaryrefslogtreecommitdiffstats
path: root/Objects/longobject.c
diff options
context:
space:
mode:
authorMark Dickinson <dickinsm@gmail.com>2016-09-10 19:20:08 (GMT)
committerMark Dickinson <dickinsm@gmail.com>2016-09-10 19:20:08 (GMT)
commit82cb124300fe85bcd3108993158e3cbe0e2e623a (patch)
tree8105055ea2a01dd1e1edf46c275914fca18a70f7 /Objects/longobject.c
parent81994006f5951f9d9093b11543fda57af3494442 (diff)
parent36820dd5a90724f68d4677e6eede29995541463c (diff)
downloadcpython-82cb124300fe85bcd3108993158e3cbe0e2e623a.zip
cpython-82cb124300fe85bcd3108993158e3cbe0e2e623a.tar.gz
cpython-82cb124300fe85bcd3108993158e3cbe0e2e623a.tar.bz2
Issue #25221: merge from 3.5.
Diffstat (limited to 'Objects/longobject.c')
-rw-r--r--Objects/longobject.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Objects/longobject.c b/Objects/longobject.c
index bbf7e71..a453241 100644
--- a/Objects/longobject.c
+++ b/Objects/longobject.c
@@ -234,7 +234,7 @@ PyLong_FromLong(long ival)
unsigned long abs_ival;
unsigned long t; /* unsigned so >> doesn't propagate sign bit */
int ndigits = 0;
- int sign = 1;
+ int sign;
CHECK_SMALL_INT(ival);
@@ -246,6 +246,7 @@ PyLong_FromLong(long ival)
}
else {
abs_ival = (unsigned long)ival;
+ sign = ival == 0 ? 0 : 1;
}
/* Fast path for single-digit ints */