summaryrefslogtreecommitdiffstats
path: root/Objects/longobject.c
diff options
context:
space:
mode:
authorBrandt Bucher <brandtbucher@microsoft.com>2023-08-04 23:24:50 (GMT)
committerGitHub <noreply@github.com>2023-08-04 23:24:50 (GMT)
commit05a824f294f1409f33e32f1799d5b413dcf24445 (patch)
tree173417047763313af6cc1a3c4c54f1d510d28d62 /Objects/longobject.c
parentec0a0d2bd9faa247d5b3208a8138e4399b2da890 (diff)
downloadcpython-05a824f294f1409f33e32f1799d5b413dcf24445.zip
cpython-05a824f294f1409f33e32f1799d5b413dcf24445.tar.gz
cpython-05a824f294f1409f33e32f1799d5b413dcf24445.tar.bz2
GH-84436: Skip refcounting for known immortals (GH-107605)
Diffstat (limited to 'Objects/longobject.c')
-rw-r--r--Objects/longobject.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/Objects/longobject.c b/Objects/longobject.c
index 5d9b413..354cba9 100644
--- a/Objects/longobject.c
+++ b/Objects/longobject.c
@@ -174,7 +174,7 @@ _PyLong_FromDigits(int negative, Py_ssize_t digit_count, digit *digits)
{
assert(digit_count >= 0);
if (digit_count == 0) {
- return (PyLongObject *)Py_NewRef(_PyLong_GetZero());
+ return (PyLongObject *)_PyLong_GetZero();
}
PyLongObject *result = _PyLong_New(digit_count);
if (result == NULL) {
@@ -2857,8 +2857,7 @@ long_divrem(PyLongObject *a, PyLongObject *b,
if (*prem == NULL) {
return -1;
}
- PyObject *zero = _PyLong_GetZero();
- *pdiv = (PyLongObject*)Py_NewRef(zero);
+ *pdiv = (PyLongObject*)_PyLong_GetZero();
return 0;
}
if (size_b == 1) {