Skip to content

Make operator protocol operands positional-only - #16809

Open
carljm wants to merge 1 commit into
python:mainfrom
carljm:cjm/operator-protocol-positional-only
Open

carljm wants to merge 1 commit into
python:mainfrom
carljm:cjm/operator-protocol-positional-only

Conversation

@carljm

@carljm carljm commented Nov 15, 2026 •

Copy link
Copy Markdown
Member

The recently-added operator module stub adds a number of new protocols with positional-or-keyword other parameters. For type checkers which fully validate signature compatibility in protocols, this means that e.g. int does not satisfy the new protocol _SupportsOr, because int.__or__ has a positional-only parameter, not a positional-or-keyword parameter named other.

Fix this by giving all of these protocols positional-only parameters, so they don't require keyword-call compatibility from implementations.

@github-actions

Copy link
Copy Markdown
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

This branch has not been deployed

No deployments
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.

1 participant