[Python-Dev] Poll: Py_REPLACE/Py_ASSIGN/etc (original) (raw)
emm.odeke at gmail.com emm.odeke at gmail.com
Sat Mar 1 02:03:24 CET 2014
- Previous message: [Python-Dev] Python 3.3.4150
- Next message: [Python-Dev] Poll: Py_REPLACE/Py_ASSIGN/etc
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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 at 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 SETITEM macros and somewhat like PyCLEAR (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 SETITEM macros do.
That actually gives me an idea that wasn't on Serhiy's original list: PySETATTR(target, value).
That does seem better. -Barry
- Previous message: [Python-Dev] Python 3.3.4150
- Next message: [Python-Dev] Poll: Py_REPLACE/Py_ASSIGN/etc
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]