Skip to content

Fix set xor return types for abstract sets - #16127

Open
subotac wants to merge 1 commit into
python:mainfrom
subotac:fix-set-xor-abstract-set
Open

Fix set xor return types for abstract sets#16127
subotac wants to merge 1 commit into
python:mainfrom
subotac:fix-set-xor-abstract-set

Conversation

@subotac

@subotac subotac commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Fixes #16115.

set.__xor__ and frozenset.__xor__ return NotImplemented for arbitrary collections.abc.Set implementations, allowing reflected dispatch to determine the result type. Preserve the concrete return type
for built-in set operands and return AbstractSet for the general case.

The new test covers both built-in left operands with an abstract set right operand.

@github-actions

Copy link
Copy Markdown
Contributor

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

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.

frozenset.__xor__ signature is wrong

1 participant