[Python-Dev] cpython: Add Py_RETURN_NOTIMPLEMENTED macro. Fixes #12724.

Alexander Belopolsky alexander.belopolsky at gmail.com
Mon Aug 15 21:04:02 CEST 2011


On Thu, Aug 11, 2011 at 3:02 AM, Antoine Pitrou <solipsis at pitrou.net> wrote:
..
>>   Add Py_RETURN_NOTIMPLEMENTED macro. Fixes #12724.
>
>
> It would sound more useful to have a generic Py_RETURN() macro rather than
> some specific forms for each and every common object.

Just my $0.02: I occasionally wish we had Py_RETURN_BOOL(1/0) instead
of Py_RETURN_TRUE/FALSE, but I feel proposed Py_RETURN() is too
ambiguous and should be called Py_RETURN_SINGLETON() or
Py_RETURN_NEWREF().  Longer spelling, however makes it less
attractive.  Overall, I am -1 on Py_RETURN().  Introducing the second
obvious way to spell Py_RETURN_NONE/TRUE/FALSE will clutter the API
and novices may be misled into always using Py_RETURN(x) instead of
return x attracting reference leaks.


More information about the Python-Dev mailing list