diff options
author | Victor Stinner <vstinner@python.org> | 2022-11-23 13:57:50 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-23 13:57:50 (GMT) |
commit | 81f7359f67a7166d57a10a3d5366406d9c85f1de (patch) | |
tree | f72a35747fa77ab9c63ba70ef9e1620daddf0cc3 /Objects/descrobject.c | |
parent | 5d9183c7ad68eb9ddb53d54a3f9a27e29dbabf31 (diff) | |
download | cpython-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 'Objects/descrobject.c')
-rw-r--r-- | Objects/descrobject.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/Objects/descrobject.c b/Objects/descrobject.c index cc20493..c545b90 100644 --- a/Objects/descrobject.c +++ b/Objects/descrobject.c @@ -906,8 +906,7 @@ descr_new(PyTypeObject *descrtype, PyTypeObject *type, const char *name) descr->d_type = (PyTypeObject*)Py_XNewRef(type); descr->d_name = PyUnicode_InternFromString(name); if (descr->d_name == NULL) { - Py_DECREF(descr); - descr = NULL; + Py_SETREF(descr, NULL); } else { descr->d_qualname = NULL; |