diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/pypy2_bugs.txt | 3 | ||||
-rw-r--r-- | tests/run/buffer_n_overflowcheck_T5356.pyx | 17 |
2 files changed, 20 insertions, 0 deletions
diff --git a/tests/pypy2_bugs.txt b/tests/pypy2_bugs.txt index 1ac25918f..9c98cb913 100644 --- a/tests/pypy2_bugs.txt +++ b/tests/pypy2_bugs.txt @@ -33,3 +33,6 @@ memoryview.numpy_memoryview # (the overridden __Pyx_PyObject_GetItem requires CYTHON_USE_TYPE_SLOTS) run.test_genericclass run.test_subclassinit + +# TypeError: 'memoryview' does not have the buffer interface +run.buffer_n_overflowcheck_T5356 diff --git a/tests/run/buffer_n_overflowcheck_T5356.pyx b/tests/run/buffer_n_overflowcheck_T5356.pyx new file mode 100644 index 000000000..519a35181 --- /dev/null +++ b/tests/run/buffer_n_overflowcheck_T5356.pyx @@ -0,0 +1,17 @@ +# mode: run +# ticket: t5356 + +cimport cython + + +@cython.overflowcheck(True) +cdef size_t _mul_checked(size_t a, size_t b) except? -1: + return a * b + + +def f(unsigned char[:] a, unsigned char[:] b): + """ + >>> f(memoryview(bytearray(b"12")), memoryview(bytearray(b"345"))) + 6 + """ + return _mul_checked(a.shape[0], b.shape[0]) |