Author: Matti Picus <matti.pi...@gmail.com>
Branch: unicode-utf8-py3
Changeset: r95045:4d6b95166120
Date: 2018-08-29 14:55 +0200
http://bitbucket.org/pypy/pypy/changeset/4d6b95166120/

Log:    unicode -> str, str_w -> text_w

diff --git a/pypy/module/__pypy__/test/test_builders.py 
b/pypy/module/__pypy__/test/test_builders.py
--- a/pypy/module/__pypy__/test/test_builders.py
+++ b/pypy/module/__pypy__/test/test_builders.py
@@ -9,11 +9,11 @@
         b.append("1")
         s = b.build()
         assert s == "abc1231"
-        assert type(s) is unicode
+        assert type(s) is str
         assert b.build() == s
         b.append("123")
         assert b.build() == s + "123"
-        assert type(b.build()) is unicode
+        assert type(b.build()) is str
 
     def test_preallocate(self):
         from __pypy__.builders import StringBuilder
@@ -22,7 +22,7 @@
         b.append("123")
         s = b.build()
         assert s == "abc123"
-        assert type(s) is unicode
+        assert type(s) is str
 
     def test_append_slice(self):
         from __pypy__.builders import StringBuilder
diff --git a/pypy/module/_codecs/interp_codecs.py 
b/pypy/module/_codecs/interp_codecs.py
--- a/pypy/module/_codecs/interp_codecs.py
+++ b/pypy/module/_codecs/interp_codecs.py
@@ -767,16 +767,16 @@
     final = space.is_true(w_final)
     state = space.fromcache(CodecState)
     if byteorder == 0:
-        byteorder = 'native'
+        _byteorder = 'native'
     elif byteorder == -1:
-        byteorder = 'little'
+        _byteorder = 'little'
     else:
-        byteorder = 'big'
-    res, lgt, pos = str_decode_utf_16_helper(
+        _byteorder = 'big'
+    res, lgt, pos, bo = str_decode_utf_16_helper(
         data, errors, final,
-        state.decode_error_handler, byteorder)
+        state.decode_error_handler, _byteorder)
     return space.newtuple([space.newutf8(res, lgt),
-                           space.newint(lgt)])
+                           space.newint(lgt), space.newint(bo)])
 
 @unwrap_spec(data='bufferstr', errors='text_or_none', byteorder=int,
              w_final=WrappedDefault(False))
@@ -786,16 +786,16 @@
     final = space.is_true(w_final)
     state = space.fromcache(CodecState)
     if byteorder == 0:
-        byteorder = 'native'
+        _byteorder = 'native'
     elif byteorder == -1:
-        byteorder = 'little'
+        _byteorder = 'little'
     else:
-        byteorder = 'big'
-    res, lgt, pos = str_decode_utf_32_helper(
+        _byteorder = 'big'
+    res, lgt, pos, bo = str_decode_utf_32_helper(
         data, errors, final,
-        state.decode_error_handler, byteorder)
+        state.decode_error_handler, _byteorder)
     return space.newtuple([space.newutf8(res, lgt),
-                           space.newint(lgt)])
+                           space.newint(lgt), space.newint(bo)])
 
 # ____________________________________________________________
 # Charmap
diff --git a/pypy/module/_cppyy/test/test_zjit.py 
b/pypy/module/_cppyy/test/test_zjit.py
--- a/pypy/module/_cppyy/test/test_zjit.py
+++ b/pypy/module/_cppyy/test/test_zjit.py
@@ -260,7 +260,7 @@
 
     def getattr(self, w_obj, w_name):
         assert isinstance(w_obj, FakeException)
-        assert self.str_w(w_name) == "__name__"
+        assert self.text_w(w_name) == "__name__"
         return FakeString(w_obj.name)
 
     def findattr(self, w_obj, w_name):
diff --git a/pypy/module/_socket/test/test_sock_app.py 
b/pypy/module/_socket/test/test_sock_app.py
--- a/pypy/module/_socket/test/test_sock_app.py
+++ b/pypy/module/_socket/test/test_sock_app.py
@@ -221,7 +221,7 @@
     w_obj = addr_as_object(rsocket.Address(c_addr, 1 + 2), -1, space)
     assert space.isinstance_w(w_obj, space.w_tuple)
     assert space.int_w(space.getitem(w_obj, space.wrap(0))) == 15
-    assert space.str_w(space.getitem(w_obj, space.wrap(1))) == 'c'
+    assert space.text_w(space.getitem(w_obj, space.wrap(1))) == 'c'
 
 def test_addr_raw_packet():
     from pypy.module._socket.interp_socket import addr_as_object
diff --git a/pypy/module/cpyext/test/test_cpyext.py 
b/pypy/module/cpyext/test/test_cpyext.py
--- a/pypy/module/cpyext/test/test_cpyext.py
+++ b/pypy/module/cpyext/test/test_cpyext.py
@@ -207,7 +207,7 @@
     if w_include_dirs is None:
         return None
     else:
-        return [space.str_w(s) for s in space.listview(w_include_dirs)]
+        return [space.text_w(s) for s in space.listview(w_include_dirs)]
 
 def debug_collect(space):
     rawrefcount._collect()
diff --git a/pypy/module/imp/test/test_import.py 
b/pypy/module/imp/test/test_import.py
--- a/pypy/module/imp/test/test_import.py
+++ b/pypy/module/imp/test/test_import.py
@@ -885,7 +885,7 @@
         finally:
             stream.close()
         filename = space.getattr(w_ret, space.wrap('__file__'))
-        assert space.str_w(filename) == u'?'
+        assert space.text_w(filename) == u'?'
 
     def test_parse_source_module(self):
         space = self.space
diff --git a/pypy/module/micronumpy/test/test_ndarray.py 
b/pypy/module/micronumpy/test/test_ndarray.py
--- a/pypy/module/micronumpy/test/test_ndarray.py
+++ b/pypy/module/micronumpy/test/test_ndarray.py
@@ -178,8 +178,8 @@
                                                            space.wrap("b")]),
                                             None)
         assert shape == [2]
-        assert space.str_w(elems[0]) == "a"
-        assert space.str_w(elems[1]) == "b"
+        assert space.text_w(elems[0]) == "a"
+        assert space.text_w(elems[1]) == "b"
 
     def test_from_shape_and_storage(self):
         from rpython.rlib.rawstorage import alloc_raw_storage, 
raw_storage_setitem
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to