summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorDennis Sweeney <36520290+sweeneyde@users.noreply.github.com>2022-04-11 20:07:09 (GMT)
committerGitHub <noreply@github.com>2022-04-11 20:07:09 (GMT)
commit8be8949116e1812df5e329a18647ebdea7fb9c6c (patch)
tree08bef3122e0eb3dc131c454bb1f927a23bb93879 /Objects
parenta8abb76af92a5f6883a640a987f9f45b47ec852b (diff)
downloadcpython-8be8949116e1812df5e329a18647ebdea7fb9c6c.zip
cpython-8be8949116e1812df5e329a18647ebdea7fb9c6c.tar.gz
cpython-8be8949116e1812df5e329a18647ebdea7fb9c6c.tar.bz2
gh-91117: Ensure integer mod and pow operations use cached small ints (GH-31843)
Diffstat (limited to 'Objects')
-rw-r--r--Objects/longobject.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/Objects/longobject.c b/Objects/longobject.c
index f85ef24..cc4aef3 100644
--- a/Objects/longobject.c
+++ b/Objects/longobject.c
@@ -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;
}