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

MRAB stackoverflow at mrabarnett.plus.com
Tue Mar 18 22:19:26 CET 2014
On 2014-03-18 21:06, Nick Coghlan wrote:
>
> On 19 Mar 2014 05:10, "Larry Hastings" <larry at hastings.org
> <mailto:larry at 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 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:  +3  (Antoine, Kristján, Nick)
>  >>
>  >> Well, now that I know that -1 are counted, -1 to this.
>  >
>  >
>  > Me too, -1 to Py_SETREF / Py_XSETREF.
>
> I think we're going to have to resort to BDFL appeal on this one -
> consensus seems unlikely at this point.
>
FWIW, I haven't been following the discussion, but, after a (very)
quick look, to me:

     Py_XDECREF(ptr);
     ptr = NULL;

would be clearer as:

     Py_CLEAR_REF(ptr);

and:

      Py_XDECREF(ptr);
      ptr = new_value;

would be clearer as:

     Py_REPLACE_REF(ptr, new_value);



More information about the Python-Dev mailing list