summaryrefslogtreecommitdiffstats
path: root/Modules/mathmodule.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2022-11-14 15:21:23 (GMT)
committerGitHub <noreply@github.com>2022-11-14 15:21:23 (GMT)
commit3e2f7135e6164860b763cf5d0d22b9dc12409767 (patch)
treed32b9ee479403299d16d9fe723618667a81591d5 /Modules/mathmodule.c
parente3d4fed07429670af631e5662086b76c1ec098c4 (diff)
downloadcpython-3e2f7135e6164860b763cf5d0d22b9dc12409767.zip
cpython-3e2f7135e6164860b763cf5d0d22b9dc12409767.tar.gz
cpython-3e2f7135e6164860b763cf5d0d22b9dc12409767.tar.bz2
gh-99300: Use Py_NewRef() in Modules/ directory (#99469)
Replace Py_INCREF() and Py_XINCREF() with Py_NewRef() and Py_XNewRef() in test C files of the Modules/ directory.
Diffstat (limited to 'Modules/mathmodule.c')
-rw-r--r--Modules/mathmodule.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/Modules/mathmodule.c b/Modules/mathmodule.c
index 4642787..16a2f45 100644
--- a/Modules/mathmodule.c
+++ b/Modules/mathmodule.c
@@ -2048,8 +2048,7 @@ factorial_odd_part(unsigned long n)
inner = PyLong_FromLong(1);
if (inner == NULL)
return NULL;
- outer = inner;
- Py_INCREF(outer);
+ outer = Py_NewRef(inner);
upper = 3;
for (i = _Py_bit_length(n) - 2; i >= 0; i--) {
@@ -3521,8 +3520,7 @@ perm_comb(PyObject *n, unsigned long long k, int iscomb)
return PyLong_FromLong(1);
}
if (k == 1) {
- Py_INCREF(n);
- return n;
+ return Py_NewRef(n);
}
/* P(n, k) = P(n, j) * P(n-j, k-j) */