summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2020-04-30 19:41:13 -0700
committerGuido van Rossum <guido@python.org>2020-04-30 19:41:13 -0700
commit5bac91d3e8a7c266e391438f73e612f350a4cd6e (patch)
tree8aede6d86cb166a5b8755befcd17b0bba314c5d5
parentb66c0ff8af0c1a4adc6908897b2d05afc78cc27e (diff)
downloadcpython-git-fix-tok-type-comments-flag.tar.gz
Ensure that tok->type_comments is set on every pathfix-tok-type-comments-flag
-rw-r--r--Parser/pegen/pegen.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/Parser/pegen/pegen.c b/Parser/pegen/pegen.c
index 5a2491c181..bf8887be3f 100644
--- a/Parser/pegen/pegen.c
+++ b/Parser/pegen/pegen.c
@@ -1042,6 +1042,7 @@ _PyPegen_Parser_New(struct tok_state *tok, int start_rule, int flags,
return (Parser *) PyErr_NoMemory();
}
assert(tok != NULL);
+ tok->type_comments = (flags & PyPARSE_TYPE_COMMENTS) > 0;
p->tok = tok;
p->keywords = NULL;
p->n_keyword_lists = -1;
@@ -1194,8 +1195,6 @@ _PyPegen_run_parser_from_string(const char *str, int start_rule, PyObject *filen
mod_ty result = NULL;
int parser_flags = compute_parser_flags(flags);
- tok->type_comments = (parser_flags & PyPARSE_TYPE_COMMENTS) > 0;
-
Parser *p = _PyPegen_Parser_New(tok, start_rule, parser_flags, NULL, arena);
if (p == NULL) {
goto error;