diff options
author | 0dminnimda <0dminnimda@gmail.com> | 2023-04-06 09:20:05 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-06 08:20:05 +0200 |
commit | 8bf72408e867b873b1c7015aa4959f789fdba79a (patch) | |
tree | 4f6d458c64c4ae789442020d823273b0e7fa2615 /tests | |
parent | f927b02799d7b5482f503903fe6a47f16fc4b86c (diff) | |
download | cython-8bf72408e867b873b1c7015aa4959f789fdba79a.tar.gz |
Remove unintended duplicate of `IS_UNSIGNED_IMPL` and make the macro generally available (GH-5358)
Closes https://github.com/cython/cython/issues/5356
Fixes https://github.com/cython/cython/pull/5302
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]) |