[pypy-commit] pypy py3k: fix last failing cpyext -A tests

rlamy pypy.commits at gmail.com
Fri Oct 7 12:58:14 EDT 2016


Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: py3k
Changeset: r87618:89af22d0c623
Date: 2016-10-07 17:57 +0100
http://bitbucket.org/pypy/pypy/changeset/89af22d0c623/

Log:	fix last failing cpyext -A tests

diff --git a/pypy/module/cpyext/test/array.c b/pypy/module/cpyext/test/array.c
--- a/pypy/module/cpyext/test/array.c
+++ b/pypy/module/cpyext/test/array.c
@@ -2436,7 +2436,7 @@
     if (view->buf == NULL)
         view->buf = (void *)emptybuf;
     view->len = (Py_SIZE(self)) * self->ob_descr->itemsize;
-    view->readonly = 0;
+    view->readonly = ((flags & PyBUF_WRITABLE) == 0);
     view->ndim = 1;
     view->itemsize = self->ob_descr->itemsize;
     view->suboffsets = NULL;
diff --git a/pypy/module/cpyext/test/test_arraymodule.py b/pypy/module/cpyext/test/test_arraymodule.py
--- a/pypy/module/cpyext/test/test_arraymodule.py
+++ b/pypy/module/cpyext/test/test_arraymodule.py
@@ -56,7 +56,7 @@
         module = self.import_module(name='array')
         arr = module.array('i', [1,2,3,4])
         buf = memoryview(arr)
-        exc = raises(TypeError, "buf[1] = '1'")
+        exc = raises(TypeError, "buf[1] = 1")
         assert str(exc.value) == "cannot modify read-only memory"
         if sys.byteorder == 'big':
             assert bytes(buf) == (b'\0\0\0\x01'
@@ -87,4 +87,4 @@
         arr = Sub('i', [2])
         res = [1, 2, 3] * arr
         assert res == [1, 2, 3, 1, 2, 3]
-        
+
diff --git a/pypy/module/cpyext/test/test_borrow.py b/pypy/module/cpyext/test/test_borrow.py
--- a/pypy/module/cpyext/test/test_borrow.py
+++ b/pypy/module/cpyext/test/test_borrow.py
@@ -49,8 +49,6 @@
         assert module.test_borrow_destroy() == 42
 
     def test_double_borrow(self):
-        if self.runappdirect:
-            py.test.xfail('segfault')
         module = self.import_extension('foo', [
             ("run", "METH_NOARGS",
              """


More information about the pypy-commit mailing list