KEMBAR78
Bug fix of __r<magic_methods>__ being used under the same __<magic_method>__ hook by arnav-jain1 · Pull Request #18995 · python/mypy · GitHub
Skip to content

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.

@github-actions

This comment has been minimized.

@arnav-jain1
Copy link
Contributor Author

yippee

@github-actions
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
@arnav-jain1
Copy link
Contributor Author

Yippee

@sterliakov
Copy link
Collaborator

@hauntsaninja could you post/link this to #6617 (it's locked, I can't write there)? I don't think this breaks someone's workflow, but better be cautious.

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 this pull request may close these issues.

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

3 participants