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 /Parser | |
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 'Parser')
-rw-r--r-- | Parser/parser.c | 5 | ||||
-rw-r--r-- | Parser/tokenizer.c | 8 |
2 files changed, 8 insertions, 5 deletions
diff --git a/Parser/parser.c b/Parser/parser.c index 227b918..a61b2f5 100644 --- a/Parser/parser.c +++ b/Parser/parser.c @@ -54,8 +54,9 @@ s_push(stack *s, const dfa *d, node *parent) static void s_pop(stack *s) { - if (s_empty(s)) - Py_FatalError("s_pop: parser stack underflow -- FATAL"); + if (s_empty(s)) { + Py_FatalError("parser stack underflow"); + } s->s_top++; } 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 @@ static void 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; + } } } |