[Python-Dev] Py_SETREF again (original) (raw)
Nick Coghlan ncoghlan at gmail.com
Fri Feb 12 05:34:44 EST 2016
- Previous message (by thread): [Python-Dev] Py_SETREF again
- Next message (by thread): [Python-Dev] Py_SETREF again
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 12 February 2016 at 19:45, Serhiy Storchaka <storchaka at gmail.com> wrote:
Now Raymond, who was not involved in the previous discussions, expressed the view that we should to rename PySETREF to PyXSETREF and add new PySETREF that uses PyDECREF for using in the code that used PyDECREF previously. [1]
We should discuss the need for this, and may be re-discuss the names for the macros.
I'm inclined to go with the resolution discussed later in the comments on that tracker issue - switch to spelling out the details when you want to avoid the Py_XDECREF inside the Py_SETREF macro. As Raymond notes, if you're wanting to manage when and how DECREF's occur, you may not want to hide them inside another macro at all.
I'm also wondering if it may be worth adding some notes about reference counting to PEP 7, such as:
- using Py_RETURN_NONE/FALSE/TRUE
- using Py_CLEAR
- using Py_SETREF (but being free to avoid it if you want to use Py_DECREF instead or are hand-optimising the code in some other way)
Cheers, Nick.
-- Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
- Previous message (by thread): [Python-Dev] Py_SETREF again
- Next message (by thread): [Python-Dev] Py_SETREF again
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]