mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
bpo-46361: Fix "small" int
caching (GH-30583)
This commit is contained in:
parent
09087b8519
commit
5cd9a162cd
5 changed files with 24 additions and 1 deletions
|
@ -3394,6 +3394,13 @@ dec_as_long(PyObject *dec, PyObject *context, int round)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if (n == 1) {
|
||||
sdigit val = mpd_arith_sign(x) * ob_digit[0];
|
||||
mpd_free(ob_digit);
|
||||
mpd_del(x);
|
||||
return PyLong_FromLong(val);
|
||||
}
|
||||
|
||||
assert(n > 0);
|
||||
pylong = _PyLong_New(n);
|
||||
if (pylong == NULL) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue