summaryrefslogtreecommitdiffstats
path: root/Python/errors.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2022-11-23 13:57:50 (GMT)
committerGitHub <noreply@github.com>2022-11-23 13:57:50 (GMT)
commit81f7359f67a7166d57a10a3d5366406d9c85f1de (patch)
treef72a35747fa77ab9c63ba70ef9e1620daddf0cc3 /Python/errors.c
parent5d9183c7ad68eb9ddb53d54a3f9a27e29dbabf31 (diff)
downloadcpython-81f7359f67a7166d57a10a3d5366406d9c85f1de.zip
cpython-81f7359f67a7166d57a10a3d5366406d9c85f1de.tar.gz
cpython-81f7359f67a7166d57a10a3d5366406d9c85f1de.tar.bz2
gh-99537: Use Py_SETREF(var, NULL) in C code (#99687)
Replace "Py_DECREF(var); var = NULL;" with "Py_SETREF(var, NULL);".
Diffstat (limited to 'Python/errors.c')
-rw-r--r--Python/errors.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/Python/errors.c b/Python/errors.c
index 6a42f59..05ef622 100644
--- a/Python/errors.c
+++ b/Python/errors.c
@@ -37,8 +37,7 @@ _PyErr_Restore(PyThreadState *tstate, PyObject *type, PyObject *value,
if (traceback != NULL && !PyTraceBack_Check(traceback)) {
/* XXX Should never happen -- fatal error instead? */
/* Well, it could be None. */
- Py_DECREF(traceback);
- traceback = NULL;
+ Py_SETREF(traceback, NULL);
}
/* Save these in locals to safeguard against recursive