I like Py_DECREF_REPLACE. It gives the impression that it decrefs the original and replaces it. On Wed, Feb 26, 2014 at 3:40 AM, Serhiy Storchaka <storchaka@gmail.com>wrote:
There were several suggestions for naming new macros which replace old value with new value and then (x)decref old value.
#define Py_XXX(ptr, value) \ { \ PyObject *__tmp__ = ptr; \ ptr = new_value; \ Py_DECREF(__tmp__); \ }
Listed in order of receipt:
1. Py_(X)SETREF. 2. Py_(X)ASSIGN. 3. Py_(X)DECREC_REPLACE. 4. Py_REF_ASSIGN (Py_XREF_ASSIGN? Py_REF_XASSIGN?). 5. Py_(X)REPLACE. 6. Py_(X)STORE 7. Py_CLEAR_AND_SET. 8. Py_SET_AND_(X)DECREF. 9. Py_(X)DECREF_AND_ASSIGN. 10. Py_ASSIGN_AND_(X)DECREF. 11. Other...
Let's choose the least confusing names.
See discussions at:
http://bugs.python.org/issue3081 http://bugs.python.org/issue16447 http://bugs.python.org/issue20440 http://comments.gmane.org/gmane.comp.python.devel/145346
_______________________________________________ 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/ rymg19%40gmail.com
-- Ryan If anybody ever asks me why I prefer C++ to C, my answer will be simple: "It's becauseslejfp23(@#Q*(E*EIdc-SEGFAULT. Wait, I don't think that was nul-terminated."