summaryrefslogtreecommitdiffstats
path: root/Modules/_testcapi
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2022-11-16 09:39:47 (GMT)
committerGitHub <noreply@github.com>2022-11-16 09:39:47 (GMT)
commit3ed8803ef59f80e03c40b100b04c2e13f138ceed (patch)
treeec9ce18edd242485d4e3198d8e62924e1616c4ea /Modules/_testcapi
parentea88d34de27ba2b3acaeb03c7dc7829dff40ea5c (diff)
downloadcpython-3ed8803ef59f80e03c40b100b04c2e13f138ceed.zip
cpython-3ed8803ef59f80e03c40b100b04c2e13f138ceed.tar.gz
cpython-3ed8803ef59f80e03c40b100b04c2e13f138ceed.tar.bz2
gh-99300: Replace Py_INCREF() with Py_NewRef() (#99513)
Replace Py_INCREF() and Py_XINCREF() using a cast with Py_NewRef() and Py_XNewRef().
Diffstat (limited to 'Modules/_testcapi')
-rw-r--r--Modules/_testcapi/datetime.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/Modules/_testcapi/datetime.c b/Modules/_testcapi/datetime.c
index 9fb6562..88f9929 100644
--- a/Modules/_testcapi/datetime.c
+++ b/Modules/_testcapi/datetime.c
@@ -137,11 +137,9 @@ get_timezone_utc_capi(PyObject *self, PyObject *args)
return NULL;
}
if (macro) {
- Py_INCREF(PyDateTime_TimeZone_UTC);
- return PyDateTime_TimeZone_UTC;
+ return Py_NewRef(PyDateTime_TimeZone_UTC);
}
- Py_INCREF(PyDateTimeAPI->TimeZone_UTC);
- return PyDateTimeAPI->TimeZone_UTC;
+ return Py_NewRef(PyDateTimeAPI->TimeZone_UTC);
}
static PyObject *