pyo3
pyo3 copied to clipboard
`#[pyo3(from_py_with)]` is ignored in dunder methods (`__eq__`, etc.)
Everything is in the title. Currently, #[pyo3(from_py_with)]
is just ignored for dunder methods like __eq__
in my case, you can even write fake function name, it has not effect at all.
I've started looking at the code, it seems that dunder methods use a completely different code for generation, so fixing this issue seems not so trivial. Waiting for the solution, this behavior should at least be documented, to avoid the surprise for the users.
I think it makes sense to allow [pyo3(from_py_with= ...)]
there, given that extracting types directly is already allowed. I implemented a fix in #4117, which should now handle them correctly.