From 74709f79ba0f23a7ea45430d8fe758133d21c714 Mon Sep 17 00:00:00 2001 From: Carl Friedrich Bolz-Tereick Date: Tue, 2 Mar 2021 21:27:45 +0100 Subject: woops --- pypy/objspace/std/unicodeobject.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) -- cgit v1.2.3-65-gdbad