[pypy-commit] pypy py3.5: hg merge default

arigo pypy.commits at gmail.com
Wed Feb 22 10:21:01 EST 2017


Author: Armin Rigo <arigo at tunes.org>
Branch: py3.5
Changeset: r90305:9eb20beecdd2
Date: 2017-02-22 16:20 +0100
http://bitbucket.org/pypy/pypy/changeset/9eb20beecdd2/

Log:	hg merge default

diff --git a/pypy/interpreter/baseobjspace.py b/pypy/interpreter/baseobjspace.py
--- a/pypy/interpreter/baseobjspace.py
+++ b/pypy/interpreter/baseobjspace.py
@@ -1601,16 +1601,6 @@
     def bytes_w(self, w_obj):
         return w_obj.bytes_w(self)
 
-    @not_rpython    # tests only; should be replaced with bytes0_w or text0_w
-    def str0_w(self, w_obj):
-        "Like str_w, but rejects strings with NUL bytes."
-        from rpython.rlib import rstring
-        result = self.str_w(w_obj)
-        if '\x00' in result:
-            raise oefmt(self.w_ValueError,
-                        "argument must be a string without NUL characters")
-        return rstring.assert_str0(result)
-
     def bytes0_w(self, w_obj):
         "Like bytes_w, but rejects strings with NUL bytes."
         from rpython.rlib import rstring
diff --git a/pypy/interpreter/test/test_objspace.py b/pypy/interpreter/test/test_objspace.py
--- a/pypy/interpreter/test/test_objspace.py
+++ b/pypy/interpreter/test/test_objspace.py
@@ -206,11 +206,11 @@
         res = self.space.interp_w(Function, w(None), can_be_None=True)
         assert res is None
 
-    def test_str0_w(self):
+    def test_text0_w(self):
         space = self.space
         w = space.wrap
-        assert space.str0_w(w("123")) == "123"
-        exc = space.raises_w(space.w_ValueError, space.str0_w, w("123\x004"))
+        assert space.text0_w(w("123")) == "123"
+        exc = space.raises_w(space.w_ValueError, space.text0_w, w("123\x004"))
         assert space.unicode0_w(w(u"123")) == u"123"
         exc = space.raises_w(space.w_ValueError, space.unicode0_w, w(u"123\x004"))
 
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
@@ -95,12 +95,12 @@
         # The loop above sets space.w_str and space.w_bytes.
         # We rename 'space.w_str' to 'space.w_unicode' and
         # 'space.w_text'.
+        self.w_unicode = self.w_str
+        self.w_text = self.w_str
+        del self.w_str
         self.w_dict.flag_map_or_seq = 'M'
         self.w_list.flag_map_or_seq = 'S'
         self.w_tuple.flag_map_or_seq = 'S'
-        self.w_unicode = self.w_str
-        self.w_text = self.w_str
-        self.w_str = self.w_bytes      # BACKCOMPAT kill me
         self.builtin_types['str'] = self.w_unicode
         self.builtin_types['bytes'] = self.w_bytes
         self.builtin_types["NotImplemented"] = self.w_NotImplemented


More information about the pypy-commit mailing list