diff options
author | Benjamin Peterson <benjamin@python.org> | 2009-03-02 23:31:26 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2009-03-02 23:31:26 (GMT) |
commit | f5b52246ed8a1191c3aa1da7d3c63bbe11aee020 (patch) | |
tree | dcac9a1daca7f583ff958cb61f73e9ed11b5564b /Python/pythonrun.c | |
parent | 0663a1ed793c164fb11d3dd62bebc677e260891e (diff) | |
download | cpython-f5b52246ed8a1191c3aa1da7d3c63bbe11aee020.zip cpython-f5b52246ed8a1191c3aa1da7d3c63bbe11aee020.tar.gz cpython-f5b52246ed8a1191c3aa1da7d3c63bbe11aee020.tar.bz2 |
ignore the coding cookie in compile(), exec(), and eval() if the source is a string #4626
Diffstat (limited to 'Python/pythonrun.c')
-rw-r--r-- | Python/pythonrun.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c index 65c6f5f..dee18b6 100644 --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -1002,9 +1002,17 @@ PyRun_InteractiveLoopFlags(FILE *fp, const char *filename, PyCompilerFlags *flag } /* compute parser flags based on compiler flags */ -#define PARSER_FLAGS(flags) \ - ((flags) ? ((((flags)->cf_flags & PyCF_DONT_IMPLY_DEDENT) ? \ - PyPARSE_DONT_IMPLY_DEDENT : 0)) : 0) +static int PARSER_FLAGS(PyCompilerFlags *flags) +{ + int parser_flags = 0; + if (!flags) + return 0; + if (flags->cf_flags & PyCF_DONT_IMPLY_DEDENT) + parser_flags |= PyPARSE_DONT_IMPLY_DEDENT; + if (flags->cf_flags & PyCF_IGNORE_COOKIE) + parser_flags |= PyPARSE_IGNORE_COOKIE; + return parser_flags; +} #if 0 /* Keep an example of flags with future keyword support. */ |