Skip to content

Root finders must support fallible callbacks #235

@helgee

Description

@helgee

The root finder traits in lox_math::roots currently assume that the callbacks (the functions whose roots should be computed) are infallible. This assumption does not hold when used from Python because Python has exceptions and every Python function is allowed to throw at any time.

The workaround that is currently in use is dangerous because it silently swallows errors from Python callbacks: https://github.com/lox-space/lox/blob/main/crates/lox-orbits/src/python.rs#L379

On the Rust side, we need to change the traits to support e.g. a CallbackError variant and then pass through the PyErr from Python in the wrapper.

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