[Cython] No matching signature with fused memoryview and None default

Dave Hirschfeld dave.hirschfeld at gmail.com
Mon Feb 25 22:56:45 CET 2013


With the following code I get a "No matching signature found" error.
Is this a bug?

```
%%cython
cimport cython

ctypedef fused floating:
    cython.double
    cython.float


def nosignature(floating[:] x, floating[:] myarray = None):
    print myarray is None
    return x
```

In [39]: nosignature(ones(1, dtype=np.float32), ones(1, dtype=np.float32))
False
Out[39]: <MemoryView of 'ndarray' at 0x937e4d8>

In [40]: nosignature(ones(1, dtype=np.float64), ones(1, dtype=np.float64))
False
Out[40]: <MemoryView of 'ndarray' at 0x937f2d8>

In [41]: nosignature(ones(1, dtype=np.float64))
True
Out[41]: <MemoryView of 'ndarray' at 0x9381258>

In [42]: nosignature(ones(1, dtype=np.float32))

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-42-c96cfff67289> in <module>()
----> 1 nosignature(ones(1, dtype=np.float32))

ca9.pyd in ca9.__pyx_fused_cpdef ca9.c:2282)()

TypeError: No matching signature found




Thanks,
Dave



More information about the cython-devel mailing list