diff options
Diffstat (limited to 'Objects/longobject.c')
-rw-r--r-- | Objects/longobject.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Objects/longobject.c b/Objects/longobject.c index d1c27e6..2c684cb 100644 --- a/Objects/longobject.c +++ b/Objects/longobject.c @@ -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: |