Skip to content

Commit

Permalink
Issue python#25221: merge from 3.5.
Browse files Browse the repository at this point in the history
  • Loading branch information
mdickinson committed Sep 10, 2016
2 parents 8199400 + 36820dd commit 82cb124
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions Misc/NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ What's New in Python 3.6.0 beta 1
Core and Builtins
-----------------

- Issue #25221: Fix corrupted result from PyLong_FromLong(0) when Python
is compiled with NSMALLPOSINTS = 0.

- Issue #27080: Implement formatting support for PEP 515. Initial patch
by Chris Angelico.

Expand Down
3 changes: 2 additions & 1 deletion Objects/longobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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 */
Expand Down

0 comments on commit 82cb124

Please sign in to comment.