[Python-Dev] Poll: Py_REPLACE/Py_ASSIGN/etc

Barry Warsaw barry at python.org
Fri Feb 28 23:49:17 CET 2014


On Mar 01, 2014, at 08:15 AM, Nick Coghlan wrote:

>It *is* playing refcounting games - it's decrefing the existing target
>while stealing a reference to the new target, just like the existing
>SET_ITEM macros and somewhat like Py_CLEAR (although in that case, it's
>more obvious that we will never incref NULL).

Okay, but "setting the reference" isn't one of them, which is what I read when
I see Py_SETREF. ;)

>The whole point of this macro is to take an *existing* reference and safely
>*overwrite* another existing reference, exactly as the SET_ITEM macros do.
>
>That actually gives me an idea that wasn't on Serhiy's original list:
>Py_SET_ATTR(target, value).

That does seem better.
-Barry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-dev/attachments/20140228/7fd42cd2/attachment.sig>


More information about the Python-Dev mailing list