Skip to content

Sidre's Python interface should throw errors instead of silently failing #1938

Description

@kennyweiss

PR #1936 allowed Axom's Python bindings to be installed into a uv/pip virtual environment, and run through Jupyter.

This revealed that some Sidre calls could silently fail without showing the underlying SLIC errors/warnings.
E.g. if you call the following twice:

child_group = parent_group.createGroup("child)
print( type(child_group) )  # Returns `sidre.Group` the first time; `None` in subsequent calls

The first call will return a valid group, but the second call will return a nullptr with a SLIC_WARNING that the group already exists.
In Python, child_group will be None the second time.

This comes up often in Jupyter if you rerun a cell, but unfortunately, Jupyter does not show the SLIC_WARNING in its output, so this can silently fail.

To make this more prominent, we should rewire the error handler to throw exceptions in Python.
Since Sidre already has hooks for this, I think it should be fairly easy to do this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    PythonReviewedSidreIssues related to Axom's 'sidre' component

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions