Re: [Python-Dev] Poll: Py_REPLACE/Py_ASSIGN/etc

2014-03-18 Thread Nick Coghlan
On 19 Mar 2014 07:34, "MRAB" 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 m

Re: [Python-Dev] Poll: Py_REPLACE/Py_ASSIGN/etc

2014-03-18 Thread MRAB
On 2014-03-18 21:06, Nick Coghlan wrote: On 19 Mar 2014 05:10, "Larry Hastings" mailto:la...@hastings.org>> wrote: > > On 03/18/2014 12:05 PM, Georg Brandl wrote: >> >> Am 18.03.2014 19:29, schrieb Serhiy Storchaka: >>> >>> 26.02.14 11:40, Serhiy Storchaka написав(ла): Let's ch

Re: [Python-Dev] Poll: Py_REPLACE/Py_ASSIGN/etc

2014-03-18 Thread Serhiy Storchaka
26.02.14 11:40, Serhiy Storchaka написав(ла): 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 Updated poll results. There

Re: [Python-Dev] Poll: Py_REPLACE/Py_ASSIGN/etc

2014-03-18 Thread Nick Coghlan
On 19 Mar 2014 05:10, "Larry Hastings" wrote: > > On 03/18/2014 12:05 PM, Georg Brandl wrote: >> >> Am 18.03.2014 19:29, schrieb Serhiy Storchaka: >>> >>> 26.02.14 11:40, Serhiy Storchaka написав(ла): Let's choose the least confusing names. See discussions at: http://

Re: [Python-Dev] Poll: Py_REPLACE/Py_ASSIGN/etc

2014-03-18 Thread Larry Hastings
On 03/18/2014 12:05 PM, Georg Brandl wrote: Am 18.03.2014 19:29, schrieb Serhiy Storchaka: 26.02.14 11:40, Serhiy Storchaka написав(ла): Let's choose the least confusing names. See discussions at: http://bugs.python.org/issue3081 http://bugs.python.org/issue16447 http://bugs.python.org/issue2

Re: [Python-Dev] Poll: Py_REPLACE/Py_ASSIGN/etc

2014-03-18 Thread Georg Brandl
Am 18.03.2014 19:29, schrieb Serhiy Storchaka: > 26.02.14 11:40, Serhiy Storchaka написав(ла): >> 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.gma

Re: [Python-Dev] Poll: Py_REPLACE/Py_ASSIGN/etc

2014-03-18 Thread Barry Warsaw
On Mar 18, 2014, at 08:29 PM, Serhiy Storchaka wrote: >Poll results: > >Py_(X)SETREF: +3 (Antoine, Kristján, Nick) +1 -Barry ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://m

Re: [Python-Dev] Poll: Py_REPLACE/Py_ASSIGN/etc

2014-03-18 Thread Serhiy Storchaka
26.02.14 11:40, Serhiy Storchaka написав(ла): 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 Poll results: Py_(X)SETREF:

Re: [Python-Dev] Poll: Py_REPLACE/Py_ASSIGN/etc

2014-02-28 Thread emm . odeke
Sent from my BlackBerry 10 smartphone on the Koodo network.   Original Message   From: Barry Warsaw Sent: Friday, February 28, 2014 3:50 PM To: python-dev@python.org Subject: Re: [Python-Dev] Poll: Py_REPLACE/Py_ASSIGN/etc On Mar 01, 2014, at 08:15 AM, Nick Coghlan wrote: >It *is* play

Re: [Python-Dev] Poll: Py_REPLACE/Py_ASSIGN/etc

2014-02-28 Thread Barry Warsaw
On Mar 01, 2014, at 08:15 AM, Nick Coghlan wrote: >It *is* playing refcounting games - it's decrefing the existing target >while stealing a reference to the new target, just like the existing >SET_ITEM macros and somewhat like Py_CLEAR (although in that case, it's >more obvious that we will never

Re: [Python-Dev] Poll: Py_REPLACE/Py_ASSIGN/etc

2014-02-28 Thread Nick Coghlan
On 1 Mar 2014 01:22, "Barry Warsaw" wrote: > > On Feb 28, 2014, at 10:27 PM, Nick Coghlan wrote: > > >With the new macro in place, the existing Py_CLEAR(x) macro would be > >equivalent to Py_SETREF(x, NULL). > > > >Originally I was also concerned about the "how will people know there's no > >impli

Re: [Python-Dev] Poll: Py_REPLACE/Py_ASSIGN/etc

2014-02-28 Thread Barry Warsaw
On Feb 28, 2014, at 10:27 PM, Nick Coghlan wrote: >With the new macro in place, the existing Py_CLEAR(x) macro would be >equivalent to Py_SETREF(x, NULL). > >Originally I was also concerned about the "how will people know there's no >implicit incref?", but I've since become satisfied with the fact

Re: [Python-Dev] Poll: Py_REPLACE/Py_ASSIGN/etc

2014-02-28 Thread Kristján Valur Jónsson
-bounces+kristjan=ccpgames@python.org] On Behalf Of Nick Coghlan Sent: 28. febrúar 2014 12:27 To: Larry Hastings Cc: python-dev@python.org Subject: Re: [Python-Dev] Poll: Py_REPLACE/Py_ASSIGN/etc For additional context, the idea itself is necessary for the same reason Py_CLEAR was added: to

Re: [Python-Dev] Poll: Py_REPLACE/Py_ASSIGN/etc

2014-02-28 Thread Nick Coghlan
On 28 Feb 2014 19:05, "Larry Hastings" wrote: > > On 02/26/2014 11:13 PM, Georg Brandl wrote: >> >> Am 26.02.2014 17:09, schrieb Ryan Gonzalez: >>> >>> I like Py_DECREF_REPLACE. It gives the impression that it decrefs the original >>> and replaces it. >> >> Agreed, most other suggestions are not r

Re: [Python-Dev] Poll: Py_REPLACE/Py_ASSIGN/etc

2014-02-28 Thread Larry Hastings
On 02/26/2014 11:13 PM, Georg Brandl wrote: Am 26.02.2014 17:09, schrieb Ryan Gonzalez: I like Py_DECREF_REPLACE. It gives the impression that it decrefs the original and replaces it. Agreed, most other suggestions are not really explicit enough. +1 from me too. When I saw Py_SETREF I though

Re: [Python-Dev] Poll: Py_REPLACE/Py_ASSIGN/etc

2014-02-27 Thread Kristján Valur Jónsson
rg Subject: Re: [Python-Dev] Poll: Py_REPLACE/Py_ASSIGN/etc On 27 Feb 2014 04:28, "Antoine Pitrou" mailto:solip...@pitrou.net>> wrote: > > On Wed, 26 Feb 2014 11:40:01 +0200 > Serhiy Storchaka mailto:storch...@gmail.com>> wrote: > > > There were several s

Re: [Python-Dev] Poll: Py_REPLACE/Py_ASSIGN/etc

2014-02-26 Thread Georg Brandl
Am 26.02.2014 17:09, schrieb Ryan Gonzalez: > I like Py_DECREF_REPLACE. It gives the impression that it decrefs the original > and replaces it. Agreed, most other suggestions are not really explicit enough. Georg ___ Python-Dev mailing list Python-Dev@

Re: [Python-Dev] Poll: Py_REPLACE/Py_ASSIGN/etc

2014-02-26 Thread Nick Coghlan
On 27 Feb 2014 04:28, "Antoine Pitrou" wrote: > > On Wed, 26 Feb 2014 11:40:01 +0200 > Serhiy Storchaka 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)\ > > {

Re: [Python-Dev] Poll: Py_REPLACE/Py_ASSIGN/etc

2014-02-26 Thread Antoine Pitrou
On Wed, 26 Feb 2014 11:40:01 +0200 Serhiy Storchaka 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__ =

Re: [Python-Dev] Poll: Py_REPLACE/Py_ASSIGN/etc

2014-02-26 Thread Ryan Gonzalez
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 wrote: > There were several suggestions for naming new macros which replace old > value with new value and then (x)decref old value. > > #define Py_XX

[Python-Dev] Poll: Py_REPLACE/Py_ASSIGN/etc

2014-02-26 Thread Serhiy Storchaka
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__);