diff Python/pythonrun.c @ 51956:8fe2988cf550

ignore the coding cookie in compile(), exec(), and eval() if the source is a string #4626
author Benjamin Peterson <benjamin@python.org>
date Mon, 02 Mar 2009 23:31:26 +0000
parents 14c3ab9bd706
children 3049ac17e256
line wrap: on
line diff
--- a/Python/pythonrun.c	Mon Mar 02 23:06:00 2009 +0000
+++ b/Python/pythonrun.c	Mon Mar 02 23:31:26 2009 +0000
@@ -1002,9 +1002,17 @@
 }
 
 /* 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. */