diff options
author | Victor Stinner <vstinner@python.org> | 2022-11-14 12:44:56 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-14 12:44:56 (GMT) |
commit | c340cbb7f74bc99eaf72d6a4ef5b4d504d8519c8 (patch) | |
tree | 2fa984d78bf3aa7e8c713f33c7ffdd6ed5817eb4 /Modules/_struct.c | |
parent | 9a7e9f9921804f3f90151ca42703e612697dd430 (diff) | |
download | cpython-c340cbb7f74bc99eaf72d6a4ef5b4d504d8519c8.zip cpython-c340cbb7f74bc99eaf72d6a4ef5b4d504d8519c8.tar.gz cpython-c340cbb7f74bc99eaf72d6a4ef5b4d504d8519c8.tar.bz2 |
gh-99300: Use Py_NewRef() in Modules/ directory (#99468)
Replace Py_INCREF() and Py_XINCREF() with Py_NewRef() and
Py_XNewRef() in test C files of the Modules/ directory.
Diffstat (limited to 'Modules/_struct.c')
-rw-r--r-- | Modules/_struct.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/Modules/_struct.c b/Modules/_struct.c index f9bac34..2f2eb25 100644 --- a/Modules/_struct.c +++ b/Modules/_struct.c @@ -1829,8 +1829,7 @@ Struct_iter_unpack(PyStructObject *self, PyObject *buffer) Py_DECREF(iter); return NULL; } - Py_INCREF(self); - iter->so = self; + iter->so = (PyStructObject*)Py_NewRef(self); iter->index = 0; return (PyObject *)iter; } @@ -2178,8 +2177,7 @@ cache_struct_converter(PyObject *module, PyObject *fmt, PyStructObject **ptr) s_object = PyDict_GetItemWithError(state->cache, fmt); if (s_object != NULL) { - Py_INCREF(s_object); - *ptr = (PyStructObject *)s_object; + *ptr = (PyStructObject *)Py_NewRef(s_object); return Py_CLEANUP_SUPPORTED; } else if (PyErr_Occurred()) { |