Skip to content

Commit 07cf66f

Browse files
authored
[3.10] Ensure the str member of the tokenizer is always initialised (GH-29681). (GH-29683)
(cherry picked from commit 4f006a7) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
1 parent 9841ac2 commit 07cf66f

File tree

4 files changed

+428
-3
lines changed

4 files changed

+428
-3
lines changed

Parser/pegen.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ get_error_line(Parser *p, Py_ssize_t lineno)
432432
* (multi-line) statement are stored in p->tok->interactive_src_start.
433433
* If not, we're parsing from a string, which means that the whole source
434434
* is stored in p->tok->str. */
435-
assert(p->tok->fp == NULL || p->tok->fp == stdin);
435+
assert((p->tok->fp == NULL && p->tok->str != NULL) || p->tok->fp == stdin);
436436

437437
char *cur_line = p->tok->fp_interactive ? p->tok->interactive_src_start : p->tok->str;
438438
assert(cur_line != NULL);

0 commit comments

Comments
 (0)