[Python-Dev] How to spell Py_return_None and friends (was: RE:
python/dist/src/Objects typeobject.c, 2.244, 2.245)
bac at OCF.Berkeley.EDU
Sat Oct 18 22:30:27 EDT 2003
Guido van Rossum wrote:
>>Guido van Rossum <guido at python.org> writes:
>>>Maybe PyBool_FromLong() itself could make this unneeded by adding
>>> if (ok < 0 && PyErr_Occurred())
>>> return NULL;
>>>to its start?
>>That would an incompatible change. I would expect PyBool_FromLong(i)
>>do the same thing as bool(i).
> Well, it still does, *except* if you have a pending exception. IMO
> what happens when you make a Python API call while an exception is
> pending is pretty underspecified, so it's doubtful whether this
> incompatibility matters.
>>>Maybe a pair of macros Py_return_True and Py_return_False would make
>>You should, of course, add Py_return_None to it, as well.
>>Then you will find that some contributor goes on a crusade to use
>>these throughout very quickly :-)
> There's the minor issue of how to spell it (Mark Hammond may have a
> different suggestion) but that certain contributor has my approval
> once we get the spelling agreed upon.
So I just grepped the source and checked the patch manager and don't see
any resolution on this. I know there was no objections from anyone to
do this beyond just coming up with an agreed spelling.
So Py_return_None or Py_RETURN_NONE ? I am with Mark in liking the
all-caps for macros, but I can easily live with the first suggestion as
More information about the Python-Dev