22.06.2014 13:48, Stefan Behnel kirjoitti: [clip] > > (A) [clip] > > asd.foo(np.float32(1.0)) > > I don't actually know how NumPy represents its types at the Python > level, but my guess is that it would be tricky to match these two > without teaching Cython itself something about NumPy (and how it > wraps basic C types here). I'd rather like to avoid that and live > with the above.
Agreed, it's probably not possible to properly deal with this without making use of Numpy scalar type object binary layout in some form. On the other hand, `asd.foo(np.array(1.0))` doesn't work either --- maybe the buffer code path does not trigger for scalar values. [clip] >> (B) >> >> ValueError: Buffer dtype mismatch, expected 'int64_t' but got 'double' [clip] > This looks like a bug to me at first sight. This was fixed by my PR #284 that you merged. >> (C) >> >> Then some nasty platform-dependent failures: [clip] > Generally speaking, I think that the signature matching algorithm has some > room for improvements, especially the one that matches Python signatures at > runtime. > > We should take a look at how other implementations do this dispatch. There > are multiple "generic functions" implementations for Python that do similar > things. I agree that there probably is room for improvement, possibly also speed-wise. I'll try to revisit (at some point) the csparsetools Cython implementation to see if there are low-hanging fixes that would be useful there. -- Pauli Virtanen _______________________________________________ cython-devel mailing list cython-devel@python.org https://mail.python.org/mailman/listinfo/cython-devel