This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author gdementen
Recipients gdementen
Date 2013-03-27.14:41:08
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1364395269.34.0.903596007794.issue17559@psf.upfronthosting.co.za>
In-reply-to
Content
In isspace, isalpha, isalnum and isdigit, I see code like:

/* Shortcut for single character strings */
if (PyString_GET_SIZE(self) == 1 &&
    isspace(*p))
    return PyBool_FromLong(1);

Is it intentional to not use:

if (PyString_GET_SIZE(self) == 1))
    return PyBool_FromLong(isspace(*p) != 0);

which would be faster when the result is False (but a tad slower when it is True because of the extra comparison).

Also, is there a reason (other than historical) why the macros Py_RETURN_TRUE and Py_RETURN_FALSE are not used instead of their equivalent functions PyBool_FromLong(1) and PyBool_FromLong(0)?

See:
http://hg.python.org/cpython/file/e87364449954/Objects/stringobject.c#l3324
History
Date User Action Args
2013-03-27 14:41:09gdementensetrecipients: + gdementen
2013-03-27 14:41:09gdementensetmessageid: <1364395269.34.0.903596007794.issue17559@psf.upfronthosting.co.za>
2013-03-27 14:41:09gdementenlinkissue17559 messages
2013-03-27 14:41:08gdementencreate