Skip to content

Extracting a PyReadWriteArray can panic for no reason #559

Description

@flying-sheep

This should just use .try_readwrite()? instead:

impl<'a, 'py, T: Element + 'a, D: Dimension + 'a> FromPyObject<'a, 'py>
for PyReadwriteArray<'py, T, D>
{
type Error = CastError<'a, 'py>;
fn extract(obj: Borrowed<'a, 'py, PyAny>) -> Result<Self, Self::Error> {
let array = obj.cast::<PyArray<T, D>>()?;
Ok(array.readwrite())
}
}

Related: #527

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