Author: Armin Rigo <[email protected]>
Branch: py3.5
Changeset: r88455:d80ac9390f6f
Date: 2016-11-17 18:11 +0100
http://bitbucket.org/pypy/pypy/changeset/d80ac9390f6f/

Log:    Allow the current behavior as correct too (see comments)

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
@@ -182,7 +182,22 @@
             b = self.array(t, b'\x00' * a.itemsize * 2)
             assert len(b) == 2 and b[0] == 0 and b[1] == 0
             if t in 'bB':
-                raises(BufferError, a.frombytes, a)
+                old_items = a.tolist()
+                try:
+                    a.frombytes(a)
+                except BufferError:
+                    # CPython behavior:
+                    # "cannot resize an array that is exporting buffers"
+                    # This is the general error we get when we try to
+                    # resize the array while a buffer to that array is
+                    # alive.
+                    assert a.tolist() == old_items
+                else:
+                    # PyPy behavior: we can't reasonably implement that.
+                    # It's harder to crash PyPy in this case, but not
+                    # impossible, because of get_raw_address().  Too
+                    # bad I suppose.
+                    assert a.tolist() == old_items * 2
             else:
                 raises(TypeError, a.frombytes, a)
 
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to