diff options
author | Brett Cannon <bcannon@gmail.com> | 2008-10-17 03:38:50 (GMT) |
---|---|---|
committer | Brett Cannon <bcannon@gmail.com> | 2008-10-17 03:38:50 (GMT) |
commit | da780432378e6298463889557ab43e0c156758cd (patch) | |
tree | dc622a9b62874851f90abc45524d3d2653cab9ba /Python | |
parent | 9e9dcd6d4225faa6a8b19120f009e0253d16ab92 (diff) | |
download | cpython-da780432378e6298463889557ab43e0c156758cd.zip cpython-da780432378e6298463889557ab43e0c156758cd.tar.gz cpython-da780432378e6298463889557ab43e0c156758cd.tar.bz2 |
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.
Diffstat (limited to 'Python')
-rw-r--r-- | Python/ast.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/Python/ast.c b/Python/ast.c index 6d2fa09..60906a1 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -3160,9 +3160,6 @@ decode_unicode(struct compiling *c, const char *s, size_t len, int rawmode, cons 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 @@ parsestr(struct compiling *c, const node *n, int *bytesmode) } } 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); |