Author: Matti Picus <matti.pi...@gmail.com> Branch: unicode-utf8 Changeset: r95567:26a182fd648c Date: 2019-01-02 11:34 +0200 http://bitbucket.org/pypy/pypy/changeset/26a182fd648c/
Log: test, fix for compatibility - cpython accepts invalid unicode diff --git a/pypy/module/array/interp_array.py b/pypy/module/array/interp_array.py --- a/pypy/module/array/interp_array.py +++ b/pypy/module/array/interp_array.py @@ -390,7 +390,8 @@ if len(s) % self.itemsize != 0: raise oefmt(self.space.w_ValueError, "string length not a multiple of item size") - self.check_valid_unicode(space, s) # empty for non-u arrays + # CPython accepts invalid unicode + # self.check_valid_unicode(space, s) # empty for non-u arrays oldlen = self.len new = len(s) / self.itemsize if not new: diff --git a/pypy/module/array/test/test_array.py b/pypy/module/array/test/test_array.py --- a/pypy/module/array/test/test_array.py +++ b/pypy/module/array/test/test_array.py @@ -589,6 +589,12 @@ assert a[1] == 2 assert a[2] == 3 + def test_deepcopy(self): + a = self.array('u', u'\x01\u263a\x00\ufeff') + from copy import deepcopy + b = deepcopy(a) + assert a == b + def test_addmul(self): a = self.array('i', [1, 2, 3]) assert repr(a + a) == "array('i', [1, 2, 3, 1, 2, 3])" @@ -846,12 +852,6 @@ b.byteswap() assert a != b - def test_unicode_ord_positive(self): - import sys - if sys.maxunicode == 0xffff: - skip("test for 32-bit unicodes") - raises(ValueError, self.array, 'u', b'\xff\xff\xff\xff') - def test_weakref(self): import weakref a = self.array('c', 'Hi!') _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit