# Pastebin jEuj8MTK diff -r e3c26a37f018 pypy/objspace/fake/objspace.py --- a/pypy/objspace/fake/objspace.py Thu Mar 04 16:17:03 2021 +0100 +++ b/pypy/objspace/fake/objspace.py Fri Mar 05 11:28:12 2021 +0100 @@ -72,7 +72,7 @@ def append(self, w_other): pass -class W_UnicodeOjbect(W_MyObject): +class W_UnicodeObject(W_MyObject): _length = 21 _utf8 = 'foobar' @@ -257,14 +257,14 @@ return w_some_obj() def newutf8(self, x, l): - return w_some_obj() + return W_UnicodeObject() def eq_w(self, obj1, obj2): return NonConstant(True) @specialize.argtype(1) def newtext(self, x, lgt=-1): - return W_UnicodeOjbect() + return W_UnicodeObject() newtext_or_none = newtext newfilename = newtext diff -r e3c26a37f018 pypy/objspace/std/unicodeobject.py --- a/pypy/objspace/std/unicodeobject.py Thu Mar 04 16:17:03 2021 +0100 +++ b/pypy/objspace/std/unicodeobject.py Fri Mar 05 11:28:12 2021 +0100 @@ -5,6 +5,7 @@ from rpython.rlib.objectmodel import ( compute_hash, compute_unique_id, import_from_mixin, always_inline, enforceargs, newlist_hint, specialize, we_are_translated) +from rpython.rlib.nonconst import NonConstant from rpython.rlib.rarithmetic import ovfcheck, r_uint from rpython.rlib.rstring import ( StringBuilder, split, rsplit, replace_count, startswith, endswith) @@ -1460,6 +1461,9 @@ def encode_object(space, w_obj, encoding, errors): from pypy.module._codecs.interp_codecs import _call_codec, lookup_text_codec + if NonConstant(0): + W_UnicodeObject("abc", 3) # hack to make test_ztranslation of + # _hpy_universal work :( if errors is None or errors == 'strict': # fast paths utf8 = space.utf8_w(w_obj)