Skip to content

pybind11::array constructor deprecated #1663

@soulslicer

Description

@soulslicer

I am currently using the Type Caster API.

I have a constructor as follows:

        bool load(handle src, bool imp)
        {
            array b(src, true);

It works, but I get a warning saying:

/home/user/pybind/python/test/_test.cpp:230: warning: ‘pybind11::array::array(pybind11::handle, bool)’ is deprecated: Use reinterpret_borrow<array>() or reinterpret_steal<array>() [-Wdeprecated-declarations]
             array b(src, true);
                              ^

I'm not clear how to use reinterpret_borrow etc. Can I get an example?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions