| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
To be 100% correct the input type should be widened to Iterable. The default implementation of AbstractSet handles them |
Sorry, something went wrong.
| @overload | ||
| def __xor__(self, value: set[_S] | frozenset[_S], /) -> set[_T | _S]: ... | ||
| @overload | ||
| def __xor__(self, value: AbstractSet[_S], /) -> AbstractSet[_T | _S]: ... |
There was a problem hiding this comment.
This seems incorrect, set.__xor__ doesn't return this. It only accepts set and frozenset. xor with AbstractSets instead works through an __rxor__ method on those other sets.
Sorry, something went wrong.
There was a problem hiding this comment.
Updated the builtin signatures to accept only set/frozenset and added AbstractSet.rxor for reflected dispatch; the regression test checks both paths. Could you take another look?
Sorry, something went wrong.
|
The local conflict resolution preserves the newer reflected overloads and restores reflected XOR support for AbstractSet The focused typing checks pass. The update has not been pushed yet |
Sorry, something went wrong.
|
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
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.