Skip to content

ElementArrayView lifetime errors in Python #3894

Description

@jl-wynen

ElementArrayView.__getitem__ -- dangling reference risk

lib/python/element_array_view.cpp:48

Uses return_value_policy::reference without keep_alive. If the parent Variable is GC'd, returned references dangle.

H6. ElementArrayView.__iter__ -- missing keep_alive

lib/python/element_array_view.cpp:50-52

py::make_iterator without keep_alive<0, 1>(). Compare to dataset.cpp:58-61 which does it correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions