diff options
author | jx124 <64946984+jx124@users.noreply.github.com> | 2023-05-01 19:15:47 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-01 19:15:47 (GMT) |
commit | 5078eedc5b18f0d208af6e30f60b33419132d1b6 (patch) | |
tree | 99d57cfef95a7e9fdefa3cfc39887d6c1f3b0658 /Parser/tokenizer.h | |
parent | 2d526cd32fe8b286aae38956648e508070729f8f (diff) | |
download | cpython-5078eedc5b18f0d208af6e30f60b33419132d1b6.zip cpython-5078eedc5b18f0d208af6e30f60b33419132d1b6.tar.gz cpython-5078eedc5b18f0d208af6e30f60b33419132d1b6.tar.bz2 |
gh-104016: Fixed off by 1 error in f string tokenizer (#104047)
Co-authored-by: sunmy2019 <59365878+sunmy2019@users.noreply.github.com>
Co-authored-by: Ken Jin <kenjin@python.org>
Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
Diffstat (limited to 'Parser/tokenizer.h')
-rw-r--r-- | Parser/tokenizer.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Parser/tokenizer.h b/Parser/tokenizer.h index 8b4213c..5e21718 100644 --- a/Parser/tokenizer.h +++ b/Parser/tokenizer.h @@ -10,8 +10,9 @@ extern "C" { #include "pycore_token.h" /* For token types */ -#define MAXINDENT 100 /* Max indentation level */ -#define MAXLEVEL 200 /* Max parentheses level */ +#define MAXINDENT 100 /* Max indentation level */ +#define MAXLEVEL 200 /* Max parentheses level */ +#define MAXFSTRINGLEVEL 150 /* Max f-string nesting level */ enum decoding_state { STATE_INIT, @@ -123,7 +124,7 @@ struct tok_state { enum interactive_underflow_t interactive_underflow; int report_warnings; // TODO: Factor this into its own thing - tokenizer_mode tok_mode_stack[MAXLEVEL]; + tokenizer_mode tok_mode_stack[MAXFSTRINGLEVEL]; int tok_mode_stack_index; int tok_report_warnings; #ifdef Py_DEBUG |