diff options
author | Benjamin Peterson <benjamin@python.org> | 2009-03-02 23:31:26 +0000 |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2009-03-02 23:31:26 +0000 |
commit | d9a6e17352a6d8e333c4782718cc99aec6d536e6 (patch) | |
tree | 25e0b7853076a58617b90f14754351cab385f967 /Python/pythonrun.c | |
parent | 52b65a6a6818d27707d31495a00b01391378ab11 (diff) | |
download | cpython-d9a6e17352a6d8e333c4782718cc99aec6d536e6.tar.gz |
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 65c6f5f2da..dee18b63e1 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. */ |