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.
diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c
index f82b102..75e8da4 100644
--- a/Parser/tokenizer.c
+++ b/Parser/tokenizer.c
@@ -1031,10 +1031,12 @@
tok_backup(struct tok_state *tok, int c)
{
if (c != EOF) {
- if (--tok->cur < tok->buf)
- Py_FatalError("tok_backup: beginning of buffer");
- if (*tok->cur != c)
+ if (--tok->cur < tok->buf) {
+ Py_FatalError("beginning of buffer");
+ }
+ if (*tok->cur != c) {
*tok->cur = c;
+ }
}
}