diff Python/compile.c @ 27781:cc01fb654ce3 legacy-trunk

patch #683515: "Add unicode support to compile(), eval() and exec" Incorporated nnorwitz's comment re. Py__USING_UNICODE.
author Just van Rossum <just@letterror.com>
date Mon, 10 Feb 2003 08:21:10 +0000
parents 16856c9514e0
children e9d7102f8278
line wrap: on
line diff
--- a/Python/compile.c	Mon Feb 10 03:10:43 2003 +0000
+++ b/Python/compile.c	Mon Feb 10 08:21:10 2003 +0000
@@ -4206,7 +4206,9 @@
 	PyCodeObject *co;
 	if (!com_init(&sc, filename))
 		return NULL;
-	if (TYPE(n) == encoding_decl) {
+	if (flags && flags->cf_flags & PyCF_SOURCE_IS_UTF8) {
+		sc.c_encoding = "utf-8";
+	} else if (TYPE(n) == encoding_decl) {
 		sc.c_encoding = STR(n);
 		n = CHILD(n, 0);
 	} else {