Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32.1k
GH-93143: Don't turnLOAD_FAST
intoLOAD_FAST_CHECK
#99075
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
I can look closer this evening, but mutating co_code is not ideal, so I think this is probably a good idea. |
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
There are two cases when we need to set locals to
In the first case we can set the local to However when jumping, trying to decide which locals need to be set to |
I've updated the code to skip scanning the bytecode for |
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.
👍
This feels safer and more robust than what we have now.
Uh oh!
There was an error while loading.Please reload this page.
@@ -0,0 +1,4 @@ | |||
Rather than changing :attr:`~types.CodeType.co_code`, the interpreter will | |||
now display a :exc:`RuntimeWarning` and assign :const:`None` to any fast | |||
locals that are incorrectly left unbound after jumps or :keyword:`del` |
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.
There aren't necessarily incorrect, so maybe just "locals that are unbound after ..."
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Objects/frameobject.c Outdated
PyErr_WriteUnraisable((PyObject *)frame->frame_obj); | ||
} | ||
value = Py_NewRef(Py_None); | ||
} | ||
Py_XINCREF(value); |
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.
Py_XINCREF(value); | |
Py_INCREF(value); |
bedevere-bot commentedNov 7, 2022
When you're done making the requested changes, leave the comment: |
Uh oh!
There was an error while loading.Please reload this page.
The compiler's dataflow analysis for fast locals can be invalidated by jumps or deletions while tracing. When this happens, rather than changing
co_code
(which users assume to be constant) to use the less-efficientLOAD_FAST_CHECK
everywhere, just display aRuntimeWarning
and set any problematic locals toNone
instead.