mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
gh-99537: Use Py_CLEAR() function in C code (#99686)
Replace "Py_XDECREF(var); var = NULL;" with "Py_CLEAR(var);". Don't replace "Py_DECREF(var); var = NULL;" with "Py_CLEAR(var);". It would add an useless "if (var)" test in code path where var cannot be NULL.
This commit is contained in:
parent
7e3f09cad9
commit
9a91182d4a
2 changed files with 5 additions and 12 deletions
|
@ -2383,8 +2383,7 @@ channel_list_interpreters(PyObject *self, PyObject *args, PyObject *kwds)
|
|||
goto finally;
|
||||
|
||||
except:
|
||||
Py_XDECREF(ids);
|
||||
ids = NULL;
|
||||
Py_CLEAR(ids);
|
||||
|
||||
finally:
|
||||
return ids;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue