diff options
author | Victor Stinner <vstinner@python.org> | 2020-03-06 23:54:20 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-06 23:54:20 (GMT) |
commit | 9e5d30cc99e34f4c3e7b2cd851de20816c9d1927 (patch) | |
tree | 71e726c4695b9b3b0a31d7d2516ce8ee83b52721 /Include | |
parent | 7b3c252dc7f44d4bdc4c7c82d225ebd09c78f520 (diff) | |
download | cpython-9e5d30cc99e34f4c3e7b2cd851de20816c9d1927.zip cpython-9e5d30cc99e34f4c3e7b2cd851de20816c9d1927.tar.gz cpython-9e5d30cc99e34f4c3e7b2cd851de20816c9d1927.tar.bz2 |
bpo-39882: Py_FatalError() logs the function name (GH-18819)
The Py_FatalError() function is replaced with a macro which logs
automatically the name of the current function, unless the
Py_LIMITED_API macro is defined.
Changes:
* Add _Py_FatalErrorFunc() function.
* Remove the function name from the message of Py_FatalError() calls
which included the function name.
* Update tests.
Diffstat (limited to 'Include')
-rw-r--r-- | Include/cpython/pyerrors.h | 6 | ||||
-rw-r--r-- | Include/pyerrors.h | 6 |
2 files changed, 11 insertions, 1 deletions
diff --git a/Include/cpython/pyerrors.h b/Include/cpython/pyerrors.h index f8480fb..ab2e740 100644 --- a/Include/cpython/pyerrors.h +++ b/Include/cpython/pyerrors.h @@ -178,6 +178,12 @@ PyAPI_FUNC(void) _PyErr_WriteUnraisableMsg( const char *err_msg, PyObject *obj); +PyAPI_FUNC(void) _Py_NO_RETURN _Py_FatalErrorFunc( + const char *func, + const char *message); + +#define Py_FatalError(message) _Py_FatalErrorFunc(__func__, message) + #ifdef __cplusplus } #endif diff --git a/Include/pyerrors.h b/Include/pyerrors.h index 3fd133c..399bb7c 100644 --- a/Include/pyerrors.h +++ b/Include/pyerrors.h @@ -21,7 +21,11 @@ PyAPI_FUNC(void) PyErr_GetExcInfo(PyObject **, PyObject **, PyObject **); PyAPI_FUNC(void) PyErr_SetExcInfo(PyObject *, PyObject *, PyObject *); #endif -/* Defined in Python/pylifecycle.c */ +/* Defined in Python/pylifecycle.c + + The Py_FatalError() function is replaced with a macro which logs + automatically the name of the current function, unless the Py_LIMITED_API + macro is defined. */ PyAPI_FUNC(void) _Py_NO_RETURN Py_FatalError(const char *message); #if defined(Py_DEBUG) || defined(Py_LIMITED_API) |