ignore the coding cookie in compile(), exec(), and eval() if the source is a string #4626

This commit is contained in:
Benjamin Peterson 2009-03-02 23:31:26 +00:00
parent 0663a1ed79
commit f5b52246ed
10 changed files with 63 additions and 14 deletions

View file

@ -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. */