<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body><div><div style="font-family: Calibri,sans-serif; font-size: 11pt;">Was Py_MOVEREF (or MOVE_REF) ever suggested?<br><br>Those are valid objections, and now they're raised I remember them from last time. But I don't think they're a huge concern - setting a ref count directly doesn't seem useful anyway, and the compiler/IDE will let you know pretty quick if you put an integer vs a PyObject* there.<br><br>Cheers,<br>Steve<br><br>Top-posted from my Windows Phone</div></div><div dir="ltr"><hr><span style="font-family: Calibri,sans-serif; font-size: 11pt; font-weight: bold;">From: </span><span style="font-family: Calibri,sans-serif; font-size: 11pt;"><a href="mailto:ncoghlan@gmail.com">Nick Coghlan</a></span><br><span style="font-family: Calibri,sans-serif; font-size: 11pt; font-weight: bold;">Sent: </span><span style="font-family: Calibri,sans-serif; font-size: 11pt;">12/22/2015 2:39</span><br><span style="font-family: Calibri,sans-serif; font-size: 11pt; font-weight: bold;">To: </span><span style="font-family: Calibri,sans-serif; font-size: 11pt;"><a href="mailto:storchaka@gmail.com">Serhiy Storchaka</a></span><br><span style="font-family: Calibri,sans-serif; font-size: 11pt; font-weight: bold;">Cc: </span><span style="font-family: Calibri,sans-serif; font-size: 11pt;"><a href="mailto:python-dev@python.org">python-dev@python.org</a></span><br><span style="font-family: Calibri,sans-serif; font-size: 11pt; font-weight: bold;">Subject: </span><span style="font-family: Calibri,sans-serif; font-size: 11pt;">Re: [Python-Dev] New poll about a macro for safe reference replacing</span><br><br></div>On 21 December 2015 at 23:46, Serhiy Storchaka <storchaka@gmail.com> wrote:<br>> On 16.12.15 16:12, Serhiy Storchaka wrote:<br>>><br>>> Please put your vote (a floating number from -1 to 1 including) for<br>>> every of proposed name. You also can propose new name.<br>><br>><br>> Thank you all for your votes.<br>><br>> Results of the poll:<br>><br>> Py_SETREF: +5 = +5 (Victor, Steve, Yury, Brett, Nick) +0 (Ryan, Martin)<br>><br>> Py_REPLACE_REF: +2.5 = +2.5 (Ryan, Victor, Steve, Martin) -0 (Nick)<br>><br>> Py_REPLACE: +0 = +1 (Martin) -1 (Ryan) +0 (Nick)<br>><br>> Py_RESET: 0 = +1 (Ryan) -1 (Martin)<br>><br>> Py_DECREF_REPLACE: -2 = +1 (Ryan, Martin) -3 (Victor, Steve, Nick)<br>><br>> Py_SET_POINTER, Py_SET_ATTR: -5 (Ryan, Victor, Steve, Martin, Nick)<br>><br>> Therefore Py_SETREF is the winner.<br>><br>> But I want also to remember objections against it formulated in previous<br>> discussion.<br>><br>> 1) By analogy with Py_INCREF and Py_DECREF that increment and decrement the<br>> reference counter of the object, Py_SETREF looks as it *sets* the reference<br>> counter of the object.<br>><br>> 2) By analogy with PyList_SET_ITEM, PyTuple_SET_ITEM, PyCell_SET, etc, it is<br>> not expected that Py_SETREF decrement the refcounter of the old value before<br>> overwriting it.<br><br>Avoiding those misleading associations is a good argument in favour of<br>Py_REPLACE over Py_SETREF - they didn't occur to me before casting my<br>votes, and I can definitely see them causing confusion in the future.<br><br>So perhaps the combination that makes the most sense is to add<br>Py_REPLACE (uses Py_DECREF on destination) & Py_XREPLACE (uses<br>Py_XDECREF on destination) to the existing Py_CLEAR?<br><br>Regards,<br>Nick.<br><br>-- <br>Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia<br>_______________________________________________<br>Python-Dev mailing list<br>Python-Dev@python.org<br>https://mail.python.org/mailman/listinfo/python-dev<br>Unsubscribe: https://mail.python.org/mailman/options/python-dev/steve.dower%40python.org<br></body></html>