Author: Carl Friedrich Bolz-Tereick <cfb...@gmx.de>
Branch: py3.5
Changeset: r93826:1e8c1d693fcf
Date: 2018-02-15 19:28 +0100
http://bitbucket.org/pypy/pypy/changeset/1e8c1d693fcf/

Log:    gah, nonsense. I want an decode, not encode. add assert to catch
        this at test-time in the future

diff --git a/pypy/interpreter/unicodehelper.py 
b/pypy/interpreter/unicodehelper.py
--- a/pypy/interpreter/unicodehelper.py
+++ b/pypy/interpreter/unicodehelper.py
@@ -148,6 +148,7 @@
     # which never raises UnicodeEncodeError.  Surrogate pairs are then
     # allowed, either paired or lone.  A paired surrogate is considered
     # like the non-BMP character it stands for.  See also *_utf8sp().
+    assert isinstance(uni, unicode)
     return runicode.unicode_encode_utf_8(
         uni, len(uni), "strict",
         errorhandler=encode_error_handler(space),
diff --git a/pypy/objspace/std/mapdict.py b/pypy/objspace/std/mapdict.py
--- a/pypy/objspace/std/mapdict.py
+++ b/pypy/objspace/std/mapdict.py
@@ -4,7 +4,7 @@
 from rpython.rlib.rarithmetic import intmask, r_uint
 
 from pypy.interpreter.baseobjspace import W_Root
-from pypy.interpreter.unicodehelper import encode_utf8
+from pypy.interpreter.unicodehelper import decode_utf8
 from pypy.objspace.std.dictmultiobject import (
     W_DictMultiObject, DictStrategy, ObjectDictStrategy, BaseKeyIterator,
     BaseValueIterator, BaseItemIterator, _never_equal_to_string,
@@ -432,8 +432,8 @@
     def materialize_str_dict(self, space, obj, str_dict):
         new_obj = self.back.materialize_str_dict(space, obj, str_dict)
         if self.index == DICT:
-            enc_name = encode_utf8(space, self.name)
-            str_dict[enc_name] = obj._mapdict_read_storage(self.storageindex)
+            uni_name = decode_utf8(space, self.name)
+            str_dict[uni_name] = obj._mapdict_read_storage(self.storageindex)
         else:
             self._copy_attr(obj, new_obj)
         return new_obj
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to