Hi Matus,
I made a change to optimize dispatch of fused memoryview types. I
suspect that's inadvertently caused the change. I have a reasonable idea
what needs to be fixed, but would need to investigate properly.
I don't think it's an intended change.
David
On 23/04/2023 12:14, matus valo wrote:
Hi All,
I am working on porting scipy to Cython3. The last missing part in
order to have a test suite is 2 tests failing [1]. When I investigated
the issue, I found out that Cython has changed the type of Exception.
Consider following example:
cimport numpy as cnp
import cython
ctypedef fused np_numeric_t:
cnp.int8_t
cnp.int16_t
cnp.int32_t
cnp.int64_t
cnp.uint8_t
cnp.uint16_t
cnp.uint32_t
cnp.uint64_t
cnp.float32_t
cnp.float64_t
cnp.longdouble_t
cnp.complex64_t
cnp.complex128_t
@cython.initializedcheck(False)
def bandwidth_c(np_numeric_t[:, ::1]A):
return
In cython 0.29.X I got following:
>>> import numpy as np
>>> zz = np.zeros([5, 5], dtype='M')
>>> import fused
>>> fused.bandwidth_c(zz)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "fused.pyx", line 32, in fused.__pyx_fused_cpdef
def bandwidth_c(np_numeric_t[:, ::1]A):
TypeError: No matching signature found
And in Cython3 (master branch) I got following:
>>> import numpy as np
>>> zz = np.zeros([5, 5], dtype='M')
>>> import fused
>>> fused.bandwidth_c(zz)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "fused.pyx", line 31, in fused.__pyx_fused_cpdef
@cython.initializedcheck(False)
ValueError: cannot include dtype 'M' in a buffer
The question is does someone know why the exception changed in
Cython3? I was not able to find out. Is this a feature or is it a bug?
Interestingly, I was not able to replicate this behaviour in simple
fused types containing basic types (int, float etc...).
Thanks,
Matus
[1] https://github.com/scipy/scipy/pull/18242#issuecomment-1517459666
_______________________________________________
cython-devel mailing list
cython-devel@python.org
https://mail.python.org/mailman/listinfo/cython-devel
_______________________________________________
cython-devel mailing list
cython-devel@python.org
https://mail.python.org/mailman/listinfo/cython-devel