bpo-37219: Remove errorneous optimization for differencing an empty set#13965
Conversation
tirkarthi
left a comment
There was a problem hiding this comment.
Could this case have a test for TypeError since this looks like reverting 4103e4dfbce .
|
LGTM, but would be nice to add a test. We can check the size of the set in the loop. This would give the nefit not only for empty set, but in the case of substracting the larger set from the smaller set. But this is new feature and different issue. |
|
FYI, I don't want to put a size check inside the loop. |
|
Please add also a test for an iterable of unhasables, e.g. |
|
I don't know what you're talking about. That gives a TypeError just like the existing test. |
|
Thanks @rhettinger for the PR 🌮🎉.. I'm working now to backport this PR to: 3.7, 3.8. |
|
I'm having trouble backporting to |
|
Sorry, @rhettinger, I could not cleanly backport this to |
|
Thanks @rhettinger for the PR 🌮🎉.. I'm working now to backport this PR to: 3.8. |
|
Sorry @rhettinger, I had trouble checking out the |
|
Thanks @rhettinger for the PR 🌮🎉.. I'm working now to backport this PR to: 3.8. |
|
GH-13967 is a backport of this pull request to the 3.8 branch. |
pythonGH-13965) (cherry picked from commit 1f11cf9) Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
|
GH-13968 is a backport of this pull request to the 3.7 branch. |
|
These errors are different. If add the check for the set size in the loop, the former will left, but the latter will disappear. Someone can add such optimization and miss the behavior change. See https://bugs.python.org/issue28071#msg306973. |
https://bugs.python.org/issue37219