diff Python/ast.c @ 49539:481ad3d9ffd1

Latin-1 source code was not being properly decoded when passed through compile(). This was due to left-over special-casing before UTF-8 became the default source encoding. Closes issue #3574. Thanks to Victor Stinner for help with the patch.
author Brett Cannon <bcannon@gmail.com>
date Fri, 17 Oct 2008 03:38:50 +0000
parents 6abada05c313
children cddd9180b8c8
line wrap: on
line diff
--- a/Python/ast.c	Fri Oct 17 01:50:37 2008 +0000
+++ b/Python/ast.c	Fri Oct 17 03:38:50 2008 +0000
@@ -3160,9 +3160,6 @@
     if (encoding == NULL) {
         buf = (char *)s;
         u = NULL;
-    } else if (strcmp(encoding, "iso-8859-1") == 0) {
-        buf = (char *)s;
-        u = NULL;
     } else {
         /* check for integer overflow */
         if (len > PY_SIZE_MAX / 4)
@@ -3275,8 +3272,7 @@
         }
     }
     need_encoding = (!*bytesmode && c->c_encoding != NULL &&
-                     strcmp(c->c_encoding, "utf-8") != 0 &&
-                     strcmp(c->c_encoding, "iso-8859-1") != 0);
+                     strcmp(c->c_encoding, "utf-8") != 0);
     if (rawmode || strchr(s, '\\') == NULL) {
         if (need_encoding) {
             PyObject *v, *u = PyUnicode_DecodeUTF8(s, len, NULL);