mirror of https://github.com/python/cpython
Issue #25221: Fix corrupted result from PyLong_FromLong(0) when Python is compiled with NSMALLPOSINTS = 0.
This commit is contained in:
parent
f028d9f71a
commit
36820dd5a9
|
@ -10,6 +10,9 @@ Release date: TBA
|
||||||
Core and Builtins
|
Core and Builtins
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
|
- Issue #25221: Fix corrupted result from PyLong_FromLong(0) when
|
||||||
|
Python is compiled with NSMALLPOSINTS = 0.
|
||||||
|
|
||||||
- Issue #25758: Prevents zipimport from unnecessarily encoding a filename
|
- Issue #25758: Prevents zipimport from unnecessarily encoding a filename
|
||||||
(patch by Eryk Sun)
|
(patch by Eryk Sun)
|
||||||
|
|
||||||
|
|
|
@ -234,7 +234,7 @@ PyLong_FromLong(long ival)
|
||||||
unsigned long abs_ival;
|
unsigned long abs_ival;
|
||||||
unsigned long t; /* unsigned so >> doesn't propagate sign bit */
|
unsigned long t; /* unsigned so >> doesn't propagate sign bit */
|
||||||
int ndigits = 0;
|
int ndigits = 0;
|
||||||
int sign = 1;
|
int sign;
|
||||||
|
|
||||||
CHECK_SMALL_INT(ival);
|
CHECK_SMALL_INT(ival);
|
||||||
|
|
||||||
|
@ -246,6 +246,7 @@ PyLong_FromLong(long ival)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
abs_ival = (unsigned long)ival;
|
abs_ival = (unsigned long)ival;
|
||||||
|
sign = ival == 0 ? 0 : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Fast path for single-digit ints */
|
/* Fast path for single-digit ints */
|
||||||
|
|
Loading…
Reference in New Issue