PEP 671: Document QUERY_DEREF among implementation details

This commit is contained in:
Chris Angelico 2021-12-02 09:57:15 +11:00
parent 21f6993114
commit 2f8088c384
1 changed files with 4 additions and 4 deletions

View File

@ -167,11 +167,11 @@ calculated as the function begins.
When a parameter with a late-bound default is omitted, the function will begin When a parameter with a late-bound default is omitted, the function will begin
with the parameter unbound. The function begins by testing for each parameter with the parameter unbound. The function begins by testing for each parameter
with a late-bound default using a new opcode QUERY_FAST, and if unbound, with a late-bound default using a new opcode QUERY_FAST/QUERY_DEREF, and if
evaluates the original expression. This opcode (available only for fast locals unbound, evaluates the original expression. This opcode (available only for
and not for other types of variable) pushes True onto the stack if the given fast locals and closure variables) pushes True onto the stack if the given
local has a value, and False if not - meaning that it pushes False if LOAD_FAST local has a value, and False if not - meaning that it pushes False if LOAD_FAST
would raise UnboundLocalError and True if it would succeed. or LOAD_DEREF would raise UnboundLocalError, and True if it would succeed.
Out-of-order variable references are permitted as long as the referent has a Out-of-order variable references are permitted as long as the referent has a
value from an argument or early-bound default. value from an argument or early-bound default.