Skip to content

Bug fix of __r<magic_methods>__ being used under the same __<magic_method>__ hook #18995

New issue

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

By clicking “No 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? No Sign in to your account

Merged
merged 7 commits into from
May 1, 2025

Conversation

arnav-jain1
Copy link
Contributor

@arnav-jain1 arnav-jain1 commented Apr 28, 2025

Fixes #18945 (This was a feature request that turned out to be a bug)

Essentially, I was trying to create a custom plugin and implement add. In the process I discovered that radd would implicitly be called if add has an error but it would be called under the same add hook (instead of radd) which is bad for non-commutative operations. This has been fixed.
I also added a test for it.

This comment has been minimized.

@arnav-jain1
Copy link
Contributor Author

yippee

Copy link
Contributor

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

@JukkaL JukkaL merged commit 25b1bb8 into python:master May 1, 2025
18 checks passed
No Sign up for free to join this conversation on GitHub. Already have an account? No Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

A way to prevent MyPy from implictly checking the __r<magic method>__
3 participants