[issue20440] Use Py_REPLACE/Py_XREPLACE macros

Kristján Valur Jónsson report at bugs.python.org
Fri Feb 7 11:50:56 CET 2014


Kristján Valur Jónsson added the comment:

These macros work as assignment with builtin decref, 
i.e. a smart replacement for =
We could resolve this by calling them Py_ASSIGN Py_XASSIGN
and having complementary macros Py_STORE/Py_XSTORE that will incref the new value.

However, with an added incref, does the X apply to the source or the target?
I wonder if we need the X variants in these macros.  Once you are doing things like this, why not just use X implicitly?  An extra pointer test or two is unlikely to be a performance problem in the places you might use them.

Anyway, I'll be adding this to the internal api of stackless because it is tremendously useful.

----------
nosy: +kristjan.jonsson

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20440>
_______________________________________


More information about the Python-bugs-list mailing list