[Python-Dev] Poll: Py_REPLACE/Py_ASSIGN/etc
Nick Coghlan
ncoghlan at gmail.com
Tue Mar 18 23:26:14 CET 2014
More information about the Python-Dev mailing list
Tue Mar 18 23:26:14 CET 2014
- Previous message: [Python-Dev] Poll: Py_REPLACE/Py_ASSIGN/etc
- Next message: [Python-Dev] Poll: Py_REPLACE/Py_ASSIGN/etc
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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: > > 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 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>
- Previous message: [Python-Dev] Poll: Py_REPLACE/Py_ASSIGN/etc
- Next message: [Python-Dev] Poll: Py_REPLACE/Py_ASSIGN/etc
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list