Patch #2477: Added from __future__ import unicode_literals
The new PyParser_*Ex() functions are based on Neal's suggestion and initial patch. The new __future__ feature makes all '' and r'' unicode strings. b'' and br'' stay (byte) strings.
diff --git a/Include/parsetok.h b/Include/parsetok.h
index 808c72c..ec1eb6f 100644
--- a/Include/parsetok.h
+++ b/Include/parsetok.h
@@ -28,6 +28,7 @@
#endif
#define PyPARSE_PRINT_IS_FUNCTION 0x0004
+#define PyPARSE_UNICODE_LITERALS 0x0008
@@ -41,11 +42,18 @@
PyAPI_FUNC(node *) PyParser_ParseFileFlags(FILE *, const char *, grammar *,
int, char *, char *,
perrdetail *, int);
+PyAPI_FUNC(node *) PyParser_ParseFileFlagsEx(FILE *, const char *, grammar *,
+ int, char *, char *,
+ perrdetail *, int *);
PyAPI_FUNC(node *) PyParser_ParseStringFlagsFilename(const char *,
const char *,
grammar *, int,
perrdetail *, int);
+PyAPI_FUNC(node *) PyParser_ParseStringFlagsFilenameEx(const char *,
+ const char *,
+ grammar *, int,
+ perrdetail *, int *);
/* Note that he following function is defined in pythonrun.c not parsetok.c. */
PyAPI_FUNC(void) PyParser_SetError(perrdetail *);