Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32.4k
gh-74929: Make containment checks more efficient inFrameLocalsProxy
#118624
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Is this a correctness issue or merely a performance issue? |
This is merely a performance issue. Without this change, the |
FrameLocalsProxy
FrameLocalsProxy
ncoghlan left a comment• edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
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! (PR title tweaked to better reflect its purpose)
…sProxy` (python#118624)Properly implement the `sq_contains` slot for frame locals proxy containment checks.
Uh oh!
There was an error while loading.Please reload this page.
Currently the more efficient contains function is not used when someone does
key in frame.f_locals
because that defaults tosq_contains
and it's not properly hooked. The function is only called when usingframe.f_locals.__contains__(key)
.This hooks
sq_contains
so thein
operation is much more efficient.