You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support for multiple inheritance in create_exception #4979
Yes it should be possible if you using the Python C FFI bindings, but that's too easy to misuse if you don't know Python's C API well, so I'd prefer waiting for a safe wrapper to exist.
Yeah, I was just checking out of curiosity how hard it would be to add support for them in PyO3 (by adapting create_exception or offering a separate function for it) - didn't mean for users of PyO3 to bypass this and go directly to the C API in unsafe rust.
Activity
lukasbindreiter commentedon Jun 24, 2025
create_exception eventually ends up here:
pyo3/src/err/mod.rs
Lines 388 to 400 in e486930
which then in turn calls this C function:
pyo3/pyo3-ffi/src/pyerrors.rs
Lines 311 to 316 in e486930
The python docs for this function mentions that:
So I think multiple base classes for exceptions should in theory be possible.
kylebarron commentedon Jun 24, 2025
Yes it should be possible if you using the Python C FFI bindings, but that's too easy to misuse if you don't know Python's C API well, so I'd prefer waiting for a safe wrapper to exist.
lukasbindreiter commentedon Jun 25, 2025
Yeah, I was just checking out of curiosity how hard it would be to add support for them in
PyO3(by adaptingcreate_exceptionor offering a separate function for it) - didn't mean for users of PyO3 to bypass this and go directly to the C API in unsafe rust.