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 vstinner
Recipients vstinner
Date 2019-06-25.23:16:31
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1561504591.64.0.387503975069.issue37406@roundup.psfhosted.org>
In-reply-to
Content
A Python debug build is ABI compatible with a Python release build since Python 3.8 on most platforms (except Windows, Cygwin and Android):
https://docs.python.org/3.8/whatsnew/3.8.html#debug-build-uses-the-same-abi-as-release-build

It should now be way easier to debug an application with a debug build.

I propose to remove runtime debug checks in release mode. assert() is already widely used in the C code base, but there are many runtime checks using PyErr_BadInternalCall() or PyErr_BadArgument. Example:

Py_ssize_t
PyUnicode_GetLength(PyObject *unicode)
{
    if (!PyUnicode_Check(unicode)) {
        PyErr_BadArgument();
        return -1;
    }
    if (PyUnicode_READY(unicode) == -1)
        return -1;
    return PyUnicode_GET_LENGTH(unicode);
}

Attached PR removes these checks when Python is compiled in release mode: when Py_DEBUG is not defined.

Even if I marked this issue as "performance", I don't expect a significant speedup.
History
Date User Action Args
2019-06-25 23:16:31vstinnersetrecipients: + vstinner
2019-06-25 23:16:31vstinnersetmessageid: <1561504591.64.0.387503975069.issue37406@roundup.psfhosted.org>
2019-06-25 23:16:31vstinnerlinkissue37406 messages
2019-06-25 23:16:31vstinnercreate