mirror of
https://github.com/AdaCore/cpython.git
synced 2026-02-12 12:57:15 -08:00
ignore the coding cookie in compile(), exec(), and eval() if the source is a string #4626
This commit is contained in:
@@ -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. */
|
||||
|
||||
Reference in New Issue
Block a user