diff options
author | Victor Stinner <vstinner@python.org> | 2022-11-14 15:21:23 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-14 15:21:23 (GMT) |
commit | 3e2f7135e6164860b763cf5d0d22b9dc12409767 (patch) | |
tree | d32b9ee479403299d16d9fe723618667a81591d5 /Modules/mathmodule.c | |
parent | e3d4fed07429670af631e5662086b76c1ec098c4 (diff) | |
download | cpython-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.c | 6 |
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) */ |