[3.10] Ensure the str member of the tokenizer is always initialised (GH-29681). (GH-29683)
(cherry picked from commit 4f006a789a35f5d1a7ef142bd1304ce167392457)
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
diff --git a/Parser/pegen.c b/Parser/pegen.c
index 464a902..8946aa3 100644
--- a/Parser/pegen.c
+++ b/Parser/pegen.c
@@ -432,7 +432,7 @@
* (multi-line) statement are stored in p->tok->interactive_src_start.
* If not, we're parsing from a string, which means that the whole source
* is stored in p->tok->str. */
- assert(p->tok->fp == NULL || p->tok->fp == stdin);
+ assert((p->tok->fp == NULL && p->tok->str != NULL) || p->tok->fp == stdin);
char *cur_line = p->tok->fp_interactive ? p->tok->interactive_src_start : p->tok->str;
assert(cur_line != NULL);