poor error message for wrong 1-tuple annotation #108
Labels
No Milestone
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: M-Labs/nac3#108
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
x: tuple[int32]
annotations error out withpyo3_runtime.PanicException: called `Result::unwrap()` on an `Err` value: "Expect multiple elements for tuple"
tuple[(ty, )]
. Alternatively we can also accepttuple[ty]
for 1-tuples.I am sorry that regarding this I am not sure how this should be handled.. since it is an error ultimately captured and unwraped in a rust code that is called from python. Are we able to raise a python error from rust or did I miss anything?
Absolutely - when PyO3 functions return a
PyResult
,Err
values are turned into exceptions.Example: https://git.m-labs.hk/M-Labs/nac3/src/branch/master/nac3artiq/src/lib.rs#L97-L101