I would be great to have a custom derive for exceptions, similar but more powerful than create_exception. This would e.g. allow reimplementing JSONDecodeError:
#[pyexception(module = json)]
struct JSONDecodeError {
msg: String,
doc: String,
pos: usize,
lineno: Option<usize>,
colno: Option<usize>,
}
The steps required are roughly:
#[proc_macro_attribute] function should go in pyo3cls/src/lib.rs, while the actual implementation should be in pyo3-derive-backend.If you want to work on implementing this or have any questions, feel free ask here or on gitter!
I'd like to try my hand at this. Would that be fine?
If so, I'm not super familiar with the details here, so would this issue be a good place to ask questions?
Thanks, please don't hesitate to ask us!
Yes, just ask here!
I'm nominating this for 0.12 - I actually already have a PR almost ready for #682 which would lay the groundwork for this.
Nearly everything else in 0.12 is close to being ready to go, and this is a potentially complex feature but not yet started. As much as I'm looking forward to having this, I'm going to delay this to the 0.13 release so we have time to design and implement properly.
Most helpful comment
I'm nominating this for
0.12- I actually already have a PR almost ready for #682 which would lay the groundwork for this.