-
-
Notifications
You must be signed in to change notification settings - Fork 31.3k
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
OrderedDict iterator allocates di_result unnecessarily #90243
Comments
The OrderedDict iterator caches a di_result tuple for use with iter(od.items()). It's *supposed* to only do that for the items() case, but the code does
to test for this case. This is the wrong test. It should be
The current test allocates di_result for key and value iterators as well as items iterators. |
Nice catch.
You can reduce one branch by
|
Almost - C's weird bitwise operator precedence means it has to be parenthesized as
|
Thanks for reporting Kevin! |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: