[C++-sig] extracting a numpy.int32 type

Nathan Huesken boost-python at lonely-star.org
Wed Dec 9 13:25:24 CET 2009


Hi,

I have something like this in my code:
void function(numeric::array& ids)
{
    ...
    int x=extract<int>(ids[make_tuple(pos)]);
    ...
}

Now I plug in a numpy arra with dtype=np.int32.
I get:

No registered converter was able to produce a C++ rvalue of type int
from this Python object of type numpy.int32

It also happens for numpy.int64. But if I extract i.E. a double from a
numpy.float64 array, it works.

What can I do here?
Thanks!
Nathan


More information about the Cplusplus-sig mailing list