mirror of
https://github.com/python/cpython.git
synced 2025-08-02 16:13:13 +00:00
gh-91117: Ensure integer mod and pow operations use cached small ints (GH-31843)
This commit is contained in:
parent
a8abb76af9
commit
8be8949116
3 changed files with 45 additions and 0 deletions
|
@ -2679,6 +2679,7 @@ long_divrem(PyLongObject *a, PyLongObject *b,
|
|||
}
|
||||
else {
|
||||
z = x_divrem(a, b, prem);
|
||||
*prem = maybe_small_long(*prem);
|
||||
if (z == NULL)
|
||||
return -1;
|
||||
}
|
||||
|
@ -2732,6 +2733,7 @@ long_rem(PyLongObject *a, PyLongObject *b, PyLongObject **prem)
|
|||
else {
|
||||
/* Slow path using divrem. */
|
||||
Py_XDECREF(x_divrem(a, b, prem));
|
||||
*prem = maybe_small_long(*prem);
|
||||
if (*prem == NULL)
|
||||
return -1;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue