
Sent from my BlackBerry 10 smartphone on the Koodo network. Original Message From: Barry Warsaw Sent: Friday, February 28, 2014 3:50 PM To: python-dev@python.org Subject: Re: [Python-Dev] Poll: Py_REPLACE/Py_ASSIGN/etc 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