mirror of
https://github.com/python/cpython.git
synced 2025-10-06 15:11:58 +00:00
gh-99537: Use Py_SETREF(var, NULL) in C code (#99687)
Replace "Py_DECREF(var); var = NULL;" with "Py_SETREF(var, NULL);".
This commit is contained in:
parent
5d9183c7ad
commit
81f7359f67
22 changed files with 44 additions and 87 deletions
|
@ -283,8 +283,7 @@ method_repr(PyMethodObject *a)
|
|||
}
|
||||
|
||||
if (funcname != NULL && !PyUnicode_Check(funcname)) {
|
||||
Py_DECREF(funcname);
|
||||
funcname = NULL;
|
||||
Py_SETREF(funcname, NULL);
|
||||
}
|
||||
|
||||
/* XXX Shouldn't use repr()/%R here! */
|
||||
|
@ -484,8 +483,7 @@ instancemethod_repr(PyObject *self)
|
|||
return NULL;
|
||||
}
|
||||
if (funcname != NULL && !PyUnicode_Check(funcname)) {
|
||||
Py_DECREF(funcname);
|
||||
funcname = NULL;
|
||||
Py_SETREF(funcname, NULL);
|
||||
}
|
||||
|
||||
result = PyUnicode_FromFormat("<instancemethod %V at %p>",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue