diff options
author | Victor Stinner <vstinner@python.org> | 2022-11-10 08:03:39 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-10 08:03:39 (GMT) |
commit | d8f239d86eb70c31aa4c4ac46a1d0a27bdb14b20 (patch) | |
tree | 7055b2d966bf41e636751177cea0248b56072e92 /Python/errors.c | |
parent | f883b7f8ee3209b52863fc662343c8cd81abdc59 (diff) | |
download | cpython-d8f239d86eb70c31aa4c4ac46a1d0a27bdb14b20.zip cpython-d8f239d86eb70c31aa4c4ac46a1d0a27bdb14b20.tar.gz cpython-d8f239d86eb70c31aa4c4ac46a1d0a27bdb14b20.tar.bz2 |
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/errors.c')
-rw-r--r-- | Python/errors.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/Python/errors.c b/Python/errors.c index fc3e468..7d2dd9b 100644 --- a/Python/errors.c +++ b/Python/errors.c @@ -326,8 +326,7 @@ _PyErr_NormalizeException(PyThreadState *tstate, PyObject **exc, set to NULL. */ if (!value) { - value = Py_None; - Py_INCREF(value); + value = Py_NewRef(Py_None); } /* Normalize the exception so that if the type is a class, the @@ -1287,8 +1286,7 @@ make_unraisable_hook_args(PyThreadState *tstate, PyObject *exc_type, if (exc_type == NULL) { \ exc_type = Py_None; \ } \ - Py_INCREF(exc_type); \ - PyStructSequence_SET_ITEM(args, pos++, exc_type); \ + PyStructSequence_SET_ITEM(args, pos++, Py_NewRef(exc_type)); \ } while (0) |