diff options
Diffstat (limited to 'pypy')
-rw-r--r-- | pypy/objspace/std/unicodeobject.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/pypy/objspace/std/unicodeobject.py b/pypy/objspace/std/unicodeobject.py index 16edebfb03..1e080f6a40 100644 --- a/pypy/objspace/std/unicodeobject.py +++ b/pypy/objspace/std/unicodeobject.py @@ -1216,7 +1216,7 @@ def encode_object(space, w_obj, encoding, errors): if rutf8.has_surrogates(utf8): utf8 = rutf8.reencode_utf8_with_surrogates(utf8) return space.newbytes(utf8) - if (encoding == "latin1" or encoding == "latin-1" and + if ((encoding == "latin1" or encoding == "latin-1") and isinstance(w_obj, W_UnicodeObject) and w_obj.is_ascii()): return space.newbytes(w_obj._utf8) return encode(space, w_obj, encoding, errors) |