Skip to content

Segfault on failed dispatching of an overrided method involving a pyarray argument #174

@PerretB

Description

@PerretB

I am not sure if the bug comes from xtensor-python or pybind11 but as far as I can tell it is specific to xtensor-python.

Assume that we have the following cpp code:

m.def("foo", [](xt::pyarray<float> array){return 0;});

with m a pybind11 module.

Then, the following python instruction leads to a segfault:

foo("bar")

Note that this does not happen when using pybind11 wrapper for numpy arrays.
Trying to call the following definition:

m.def("foo", [](pybind11::array_t<float> array){return 0;});

with a string argument produces the expected error:

TypeError: foo(): incompatible function arguments. The following argument types are supported:
    1. (arg0: numpy.ndarray[float32]) -> int

Also note that I remember that this was working fine a few months ago (before summer).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions