Skip to content

[mypyc] Use other arg instead of self for RHS type#21569

Merged
p-sawicki merged 2 commits into
python:masterfrom
rheard:fix-21568
Jun 1, 2026
Merged

[mypyc] Use other arg instead of self for RHS type#21569
p-sawicki merged 2 commits into
python:masterfrom
rheard:fix-21568

Conversation

@rheard
Copy link
Copy Markdown
Contributor

@rheard rheard commented May 30, 2026

Fixes #21568

In gen_glue_ne_method, mypyc currently chooses the generated RHS argument type like this when strict dunder typing is enabled:

rhs_type = eq_sig.args[0].type if strict_typing else object_rprimitive

However, the __eq__ signature includes self, so eq_sig.args[0] is the type of self, not the type of other.

@rheard rheard changed the title Use other arg instead of self for RHS type [mypyc] Use other arg instead of self for RHS type May 30, 2026
Comment thread mypyc/irbuild/classdef.py Outdated
Co-authored-by: Piotr Sawicki <sawickipiotr@outlook.com>
Copy link
Copy Markdown
Collaborator

@p-sawicki p-sawicki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@p-sawicki p-sawicki merged commit cd75c4e into python:master Jun 1, 2026
18 checks passed
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.

mypyc generated __ne__ uses self type instead of __eq__'s RHS type with strict dunder typing

2 participants