mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +00:00
Issue #20440: Cleaning up the code by using Py_SETREF and Py_CLEAR.
Old code is correct, but with Py_SETREF and Py_CLEAR it can be cleaner. This patch doesn't fix bugs and hence there is no need to backport it.
This commit is contained in:
parent
726fc139a5
commit
1ed017ae92
9 changed files with 23 additions and 71 deletions
|
|
@ -2338,13 +2338,9 @@ _elementtree_TreeBuilder___init___impl(TreeBuilderObject *self,
|
|||
PyObject *element_factory)
|
||||
/*[clinic end generated code: output=91cfa7558970ee96 input=1b424eeefc35249c]*/
|
||||
{
|
||||
PyObject *tmp;
|
||||
|
||||
if (element_factory) {
|
||||
Py_INCREF(element_factory);
|
||||
tmp = self->element_factory;
|
||||
self->element_factory = element_factory;
|
||||
Py_XDECREF(tmp);
|
||||
Py_SETREF(self->element_factory, element_factory);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue