[pypy-commit] pypy py3.6: test, fix for strip(buffer)

mattip pypy.commits at gmail.com
Wed Apr 10 23:18:16 EDT 2019


Author: Matti Picus <matti.picus at gmail.com>
Branch: py3.6
Changeset: r96440:4ff72cf6b182
Date: 2019-04-11 06:17 +0300
http://bitbucket.org/pypy/pypy/changeset/4ff72cf6b182/

Log:	test, fix for strip(buffer)

diff --git a/pypy/objspace/std/test/test_unicodeobject.py b/pypy/objspace/std/test/test_unicodeobject.py
--- a/pypy/objspace/std/test/test_unicodeobject.py
+++ b/pypy/objspace/std/test/test_unicodeobject.py
@@ -524,6 +524,7 @@
         assert 'xyzzyhelloxyzzy'.strip('xyz') == 'hello'
         assert 'xyzzyhelloxyzzy'.lstrip('xyz') == 'helloxyzzy'
         assert 'xyzzyhelloxyzzy'.rstrip('xyz') == 'xyzzyhello'
+        raises(TypeError, s.strip, bytearray(b'a'))
 
     def test_long_from_unicode(self):
         assert int('12345678901234567890') == 12345678901234567890
diff --git a/pypy/objspace/std/unicodeobject.py b/pypy/objspace/std/unicodeobject.py
--- a/pypy/objspace/std/unicodeobject.py
+++ b/pypy/objspace/std/unicodeobject.py
@@ -134,7 +134,7 @@
                     "Can't convert '%T' object to str implicitly", w_other)
         if strict:
             raise oefmt(space.w_TypeError,
-                "%s arg must be None, unicode or str", strict)
+                "%s arg must be None or str", strict)
         return decode_object(space, w_other, 'utf8', "strict")
 
     def convert_to_w_unicode(self, space):
@@ -1135,7 +1135,7 @@
     def _strip(self, space, w_chars, left, right, name='strip'):
         "internal function called by str_xstrip methods"
         value = self._utf8
-        chars = self.convert_arg_to_w_unicode(space, w_chars)._utf8
+        chars = self.convert_arg_to_w_unicode(space, w_chars, name)._utf8
 
         lpos = 0
         rpos = len(value)


More information about the pypy-commit mailing list