summaryrefslogtreecommitdiffstats
path: root/Parser
diff options
context:
space:
mode:
authorPablo Galindo Salgado <Pablogsal@gmail.com>2021-11-17 23:18:16 (GMT)
committerGitHub <noreply@github.com>2021-11-17 23:18:16 (GMT)
commit0ef308a2890571c850c624fb99ac00f8951363c6 (patch)
treec3174751e24a1501235090860401965fb9335530 /Parser
parent87787c8774221c81602b31b0e0dc0678ad494e91 (diff)
downloadcpython-0ef308a2890571c850c624fb99ac00f8951363c6.zip
cpython-0ef308a2890571c850c624fb99ac00f8951363c6.tar.gz
cpython-0ef308a2890571c850c624fb99ac00f8951363c6.tar.bz2
bpo-45822: Respect PEP 263's coding cookies in the parser even if flags are not provided (GH-29582) (GH-29585)
(cherry picked from commit da20d7401de97b425897d3069f71f77b039eb16f)
Diffstat (limited to 'Parser')
-rw-r--r--Parser/pegen/pegen.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Parser/pegen/pegen.c b/Parser/pegen/pegen.c
index efcf9ac..2e986c5 100644
--- a/Parser/pegen/pegen.c
+++ b/Parser/pegen/pegen.c
@@ -1225,7 +1225,7 @@ _PyPegen_run_parser_from_string(const char *str, int start_rule, PyObject *filen
int exec_input = start_rule == Py_file_input;
struct tok_state *tok;
- if (flags == NULL || flags->cf_flags & PyCF_IGNORE_COOKIE) {
+ if (flags != NULL && flags->cf_flags & PyCF_IGNORE_COOKIE) {
tok = PyTokenizer_FromUTF8(str, exec_input);
} else {
tok = PyTokenizer_FromString(str, exec_input);