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 /Python/ceval.c | |
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 'Python/ceval.c')
-rw-r--r-- | Python/ceval.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Python/ceval.c b/Python/ceval.c index 20e32e2..04e0824 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -283,7 +283,7 @@ PyEval_AcquireLock(void) struct _ceval_runtime_state *ceval = &runtime->ceval; PyThreadState *tstate = _PyRuntimeState_GetThreadState(runtime); if (tstate == NULL) { - Py_FatalError("PyEval_AcquireLock: current thread state is NULL"); + Py_FatalError("current thread state is NULL"); } take_gil(ceval, tstate); exit_thread_if_finalizing(tstate); @@ -314,7 +314,7 @@ PyEval_AcquireThread(PyThreadState *tstate) take_gil(ceval, tstate); exit_thread_if_finalizing(tstate); if (_PyThreadState_Swap(&runtime->gilstate, tstate) != NULL) { - Py_FatalError("PyEval_AcquireThread: non-NULL old thread state"); + Py_FatalError("non-NULL old thread state"); } } @@ -326,7 +326,7 @@ PyEval_ReleaseThread(PyThreadState *tstate) _PyRuntimeState *runtime = tstate->interp->runtime; PyThreadState *new_tstate = _PyThreadState_Swap(&runtime->gilstate, NULL); if (new_tstate != tstate) { - Py_FatalError("PyEval_ReleaseThread: wrong thread state"); + Py_FatalError("wrong thread state"); } drop_gil(&runtime->ceval, tstate); } @@ -373,7 +373,7 @@ PyEval_SaveThread(void) struct _ceval_runtime_state *ceval = &runtime->ceval; PyThreadState *tstate = _PyThreadState_Swap(&runtime->gilstate, NULL); if (tstate == NULL) { - Py_FatalError("PyEval_SaveThread: NULL tstate"); + Py_FatalError("NULL tstate"); } assert(gil_created(&ceval->gil)); drop_gil(ceval, tstate); @@ -1236,7 +1236,7 @@ main_loop: if (_Py_atomic_load_relaxed(&ceval->gil_drop_request)) { /* Give another thread a chance */ if (_PyThreadState_Swap(&runtime->gilstate, NULL) != tstate) { - Py_FatalError("ceval: tstate mix-up"); + Py_FatalError("tstate mix-up"); } drop_gil(ceval, tstate); @@ -1248,7 +1248,7 @@ main_loop: exit_thread_if_finalizing(tstate); if (_PyThreadState_Swap(&runtime->gilstate, tstate) != NULL) { - Py_FatalError("ceval: orphan tstate"); + Py_FatalError("orphan tstate"); } } /* Check for asynchronous exceptions. */ |