[Python-checkins] gh-106989: Remove tok report warnings (#106993)

pablogsal webhook-mailer at python.org
Sat Jul 22 08:23:27 EDT 2023


https://github.com/python/cpython/commit/76e20c361c8d6bc20d939d436a1c3d4077a58186
commit: 76e20c361c8d6bc20d939d436a1c3d4077a58186
branch: main
author: Menelaos Kotoglou <contact at menelaoskotoglou.com>
committer: pablogsal <Pablogsal at gmail.com>
date: 2023-07-22T14:23:23+02:00
summary:

gh-106989: Remove tok report warnings (#106993)

files:
M Parser/tokenizer.c
M Parser/tokenizer.h

diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c
index f19198600fa01..ccff16045233d 100644
--- a/Parser/tokenizer.c
+++ b/Parser/tokenizer.c
@@ -116,7 +116,6 @@ tok_new(void)
     tok->implicit_newline = 0;
     tok->tok_mode_stack[0] = (tokenizer_mode){.kind =TOK_REGULAR_MODE, .f_string_quote='\0', .f_string_quote_size = 0, .f_string_debug=0};
     tok->tok_mode_stack_index = 0;
-    tok->tok_report_warnings = 1;
 #ifdef Py_DEBUG
     tok->debug = _Py_GetConfig()->parser_debug;
 #endif
@@ -1545,10 +1544,6 @@ static int
 warn_invalid_escape_sequence(struct tok_state *tok, int first_invalid_escape_char)
 {
 
-    if (!tok->tok_report_warnings) {
-        return 0;
-    }
-
     PyObject *msg = PyUnicode_FromFormat(
         "invalid escape sequence '\\%c'",
         (char) first_invalid_escape_char
diff --git a/Parser/tokenizer.h b/Parser/tokenizer.h
index cb44845c1d306..1e1daa3648f5d 100644
--- a/Parser/tokenizer.h
+++ b/Parser/tokenizer.h
@@ -128,7 +128,6 @@ struct tok_state {
     // TODO: Factor this into its own thing
     tokenizer_mode tok_mode_stack[MAXFSTRINGLEVEL];
     int tok_mode_stack_index;
-    int tok_report_warnings;
     int tok_extra_tokens;
     int comment_newline;
     int implicit_newline;



More information about the Python-checkins mailing list