Author: Matti Picus <[email protected]>
Branch: unicode-utf8-py3
Changeset: r94760:e069b9df4f5f
Date: 2018-06-13 20:36 -0700
http://bitbucket.org/pypy/pypy/changeset/e069b9df4f5f/
Log: reset invalid uses of str_decode_utf8 to deault values, need more
review
diff --git a/pypy/TODO b/pypy/TODO
--- a/pypy/TODO
+++ b/pypy/TODO
@@ -1,6 +1,3 @@
-...
-
-
antocuni's older TODO:
* run coverage against the parser/astbuilder/astcompiler: it's probably full of
@@ -11,3 +8,5 @@
* re-enable BUILD_LIST_FROM_ARG: see the comment in astcompiler/codegen.py in
ast.ListComp.build_container
+
+* review use of std_decode_utf8, we probably do not want to be using it
diff --git a/pypy/interpreter/test/test_unicodehelper.py
b/pypy/interpreter/test/test_unicodehelper.py
--- a/pypy/interpreter/test/test_unicodehelper.py
+++ b/pypy/interpreter/test/test_unicodehelper.py
@@ -16,7 +16,7 @@
from pypy.module._codecs.interp_codecs import CodecState
def decode_utf8(u):
- return str_decode_utf8(u, True, "strict", None)
+ return str_decode_utf8(u, "strict", True, None)
def test_encode_utf8_allow_surrogates():
sp = FakeSpace()
diff --git a/pypy/interpreter/unicodehelper.py
b/pypy/interpreter/unicodehelper.py
--- a/pypy/interpreter/unicodehelper.py
+++ b/pypy/interpreter/unicodehelper.py
@@ -991,7 +991,8 @@
# Surrogate-preserving utf-8 decoding. Assuming there is no
# encoding error, it should always be reversible, and the reverse is
# encode_utf8sp().
- return decode_utf8(space, string, allow_surrogates=True)
+ return str_decode_utf8(string, "string", True, decode_error_handler(space),
+ allow_surrogates=True)
# ____________________________________________________________
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
@@ -433,7 +433,7 @@
def materialize_str_dict(self, space, obj, str_dict):
new_obj = self.back.materialize_str_dict(space, obj, str_dict)
if self.index == DICT:
- uni_name = str_decode_utf8(space, self.name)
+ uni_name = str_decode_utf8(self.name, "string", True, None)[0]
str_dict[uni_name] = obj._mapdict_read_storage(self.storageindex)
else:
self._copy_attr(obj, new_obj)
diff --git a/pypy/objspace/std/objspace.py b/pypy/objspace/std/objspace.py
--- a/pypy/objspace/std/objspace.py
+++ b/pypy/objspace/std/objspace.py
@@ -334,7 +334,8 @@
def newlist_text(self, list_t):
return self.newlist_unicode([
- str_decode_utf8(self, s, allow_surrogates=True) for s in list_t])
+ str_decode_utf8(s, "string", True, None, allow_surrogates=True)[0]
+ for s in list_t])
def newlist_utf8(self, list_u, is_ascii):
if is_ascii:
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit