Skip to content
Snippets Groups Projects
  • Damien George's avatar
    9201f46c
    py/compile: Fix case of eager implicit conversion of local to nonlocal. · 9201f46c
    Damien George authored
    This ensures that implicit variables are only converted to implicit
    closed-over variables (nonlocals) at the very end of the function scope.
    If variables are closed-over when first used (read from, as was done prior
    to this commit) then this can be incorrect because the variable may be
    assigned to later on in the function which means they are just a plain
    local, not closed over.
    
    Fixes issue #4272.
    9201f46c
    History
    py/compile: Fix case of eager implicit conversion of local to nonlocal.
    Damien George authored
    This ensures that implicit variables are only converted to implicit
    closed-over variables (nonlocals) at the very end of the function scope.
    If variables are closed-over when first used (read from, as was done prior
    to this commit) then this can be incorrect because the variable may be
    assigned to later on in the function which means they are just a plain
    local, not closed over.
    
    Fixes issue #4272.