diff options
Diffstat (limited to 'tests/run/buffer_n_overflowcheck_T5356.pyx')
-rw-r--r-- | tests/run/buffer_n_overflowcheck_T5356.pyx | 17 |
1 files changed, 17 insertions, 0 deletions
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]) |