Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#[pyo3(from_py_with)] is ignored in dunder methods (__eq__, etc.) #4113

Closed
wyfo opened this issue Apr 24, 2024 · 1 comment · Fixed by #4117
Closed

#[pyo3(from_py_with)] is ignored in dunder methods (__eq__, etc.) #4113

wyfo opened this issue Apr 24, 2024 · 1 comment · Fixed by #4117

Comments

@wyfo
Copy link
Contributor

wyfo commented Apr 24, 2024

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.

@Icxolu
Copy link
Contributor

Icxolu commented Apr 24, 2024

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.

wyfo added a commit to ZettaScaleLabs/zenoh-python that referenced this issue Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants