diff options
author | Victor Stinner <vstinner@python.org> | 2022-11-10 09:03:39 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-10 09:03:39 +0100 |
commit | d8f239d86eb70c31aa4c4ac46a1d0a27bdb14b20 (patch) | |
tree | 7055b2d966bf41e636751177cea0248b56072e92 /Python/codecs.c | |
parent | f883b7f8ee3209b52863fc662343c8cd81abdc59 (diff) | |
download | cpython-git-d8f239d86eb70c31aa4c4ac46a1d0a27bdb14b20.tar.gz |
gh-99300: Use Py_NewRef() in Python/ directory (#99302)
Replace Py_INCREF() and Py_XINCREF() with Py_NewRef() and
Py_XNewRef() in C files of the Python/ directory.
Diffstat (limited to 'Python/codecs.c')
-rw-r--r-- | Python/codecs.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/Python/codecs.c b/Python/codecs.c index 33965f885f..64addf00d5 100644 --- a/Python/codecs.c +++ b/Python/codecs.c @@ -235,8 +235,7 @@ PyObject *args_tuple(PyObject *object, args = PyTuple_New(1 + (errors != NULL)); if (args == NULL) return NULL; - Py_INCREF(object); - PyTuple_SET_ITEM(args,0,object); + PyTuple_SET_ITEM(args, 0, Py_NewRef(object)); if (errors) { PyObject *v; @@ -263,8 +262,7 @@ PyObject *codec_getitem(const char *encoding, int index) return NULL; v = PyTuple_GET_ITEM(codecs, index); Py_DECREF(codecs); - Py_INCREF(v); - return v; + return Py_NewRef(v); } /* Helper functions to create an incremental codec. */ |