summaryrefslogtreecommitdiff
path: root/tests/run/buffer_n_overflowcheck_T5356.pyx
blob: 519a351810b2f10448cd1bfa813f00f57210c2d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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])