-
- Notifications
You must be signed in to change notification settings - Fork 33.4k
bpo-37219: Remove errorneous optimization for differencing an empty set #13965
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
tirkarthi left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
tirkarthi left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks.
| 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