[Python-Dev] Poll: Py_REPLACE/Py_ASSIGN/etc (original) (raw)

Nick Coghlan ncoghlan at gmail.com
Tue Mar 18 23:26:14 CET 2014


On 19 Mar 2014 07:34, "MRAB" <stackoverflow at 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:

PyXDECREF(ptr); ptr = NULL; would be clearer as: PyCLEARREF(ptr);

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

and:

PyXDECREF(ptr); ptr = newvalue; would be clearer as: PyREPLACEREF(ptr, newvalue);

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

Cheers, Nick.


Python-Dev mailing list Python-Dev at python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/ncoghlan%40gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20140319/2a565f99/attachment.html>



More information about the Python-Dev mailing list