On 19 Mar 2014 07:34, "MRAB" <stackoverflow@mrabarnett.plus.com> wrote:
> FWIW, I haven't been following the discussion,

Note that this about correctness, not just clarity - using DECREF on member attributes is not safe, as you may end up exposing a partially destroyed object to other code.

> but, after a (very)
> quick look, to me:
>
>     Py_XDECREF(ptr);
>     ptr = NULL;
>
> would be clearer as:
>
>     Py_CLEAR_REF(ptr);

Already exists as Py_CLEAR (with the correct temp variable usage).

> and:
>
>      Py_XDECREF(ptr);
>      ptr = new_value;
>
> would be clearer as:
>
>     Py_REPLACE_REF(ptr, new_value);

That is indeed the one we're aiming to find a suitable name for.

Cheers,
Nick.

>
>
> _______________________________________________
> Python-Dev mailing list
> Python-Dev@python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: https://mail.python.org/mailman/options/python-dev/ncoghlan%40gmail.com