mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +00:00
Issue #3236: Return small longs from PyLong_FromString.
This commit is contained in:
parent
2f5799b7b0
commit
029656fb3b
3 changed files with 13 additions and 0 deletions
|
|
@ -1981,6 +1981,14 @@ digit beyond the first.
|
|||
goto onError;
|
||||
if (pend)
|
||||
*pend = str;
|
||||
long_normalize(z);
|
||||
if (ABS(Py_SIZE(z)) <= 1) {
|
||||
long res = MEDIUM_VALUE(z);
|
||||
if (-NSMALLPOSINTS <= res && res <= NSMALLPOSINTS) {
|
||||
Py_DECREF(z);
|
||||
return PyLong_FromLong(res);
|
||||
}
|
||||
}
|
||||
return (PyObject *) z;
|
||||
|
||||
onError:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue