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:
Serhiy Storchaka 2015-12-27 15:51:32 +02:00
parent 726fc139a5
commit 1ed017ae92
9 changed files with 23 additions and 71 deletions

View file

@ -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;