[Python-Dev] New poll about a macro for safe reference replacing

Serhiy Storchaka storchaka at gmail.com
Tue Dec 22 04:50:22 EST 2015


On 21.12.15 17:37, Nick Coghlan wrote:
> Avoiding those misleading associations is a good argument in favour of
> Py_REPLACE over Py_SETREF - they didn't occur to me before casting my
> votes, and I can definitely see them causing confusion in the future.
>
> So perhaps the combination that makes the most sense is to add
> Py_REPLACE (uses Py_DECREF on destination) & Py_XREPLACE (uses
> Py_XDECREF on destination) to the existing Py_CLEAR?

And we return to where we started. Although I personally prefer 
Py_REPLACE/Py_XREPLACE, I'm afraid that using them would look like I 
just ignore the results of the poll. Because Py_SETREF looks good for 
most developers at first glance, I hope this will not lead to confusion 
in the future. If there are no new objections, I will commit the trivial 
auto-generated patch today and will provide a patch that covers more 
non-trivial cases. Now is better than never, and we have been 
bikeshedding this too long for "right now".




More information about the Python-Dev mailing list