Author: Matti Picus <[email protected]>
Branch: issue2752
Changeset: r94268:eb2ca00ab61a
Date: 2018-04-08 12:17 +0300
http://bitbucket.org/pypy/pypy/changeset/eb2ca00ab61a/

Log:    more simplification, crashes untranslated (at teardown?)

diff --git a/pypy/module/cpyext/test/test_bufferobject.py 
b/pypy/module/cpyext/test/test_bufferobject.py
--- a/pypy/module/cpyext/test/test_bufferobject.py
+++ b/pypy/module/cpyext/test/test_bufferobject.py
@@ -66,22 +66,20 @@
 
 
     def test_issue2752(self):
-        if not self.runappdirect:
-            skip('too slow, run with -A')
+        iterations = 10
+        if self.runappdirect:
+            iterations = 2000
         module = self.import_extension('foo', [
             ("test_mod", 'METH_VARARGS',
             """
-                PyObject *obj, *collect, *tup;
+                PyObject *obj;
                 Py_buffer bp;
-                if (!PyArg_ParseTuple(args, "OO", &obj, &collect))
+                if (!PyArg_ParseTuple(args, "O", &obj))
                     return NULL;
 
-                assert(obj);
-
                 if (PyObject_GetBuffer(obj, &bp, PyBUF_SIMPLE) == -1)
                     return NULL;
                 
-                tup = PyTuple_New(0); /* for collect() */
                 if (((unsigned char*)bp.buf)[0] != '0') {
                     PyErr_Format(PyExc_ValueError,
                             "mismatch: 0x%x [%x %x %x %x...] instead of '0' 
(got len=%d)",
@@ -92,16 +90,13 @@
                             ((unsigned char*)bp.buf)[4],
                             bp.len);
                     PyBuffer_Release(&bp);
-                    Py_DECREF(tup);
                     return NULL;
                 }
 
                 PyBuffer_Release(&bp);
-                Py_DECREF(tup);
                 Py_RETURN_NONE;
             """),
             ])
-        import io, gc
         bufsize = 4096
         def getdata(bufsize):
             data = b'01234567'
@@ -110,11 +105,11 @@
                 if len(data) >= bufsize:
                     break
             return data
-        for j in range(2000):
+        for j in range(iterations):
             block = getdata(bufsize)
             assert block[:8] == '01234567'
             try:
-                module.test_mod(block, gc.collect)
+                module.test_mod(block)
             except ValueError as e:
                 print("%s at it=%d" % (e, j))
                 assert False
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to