You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Default argument naming a local gets EvalLocalVar in a nested @pyscript_compile/@pyscript_executor function #945
A @pyscript_compile or @pyscript_executor function defined inside a pyscript function gets pyscript's internal EvalLocalVar cell instead of the value when a default argument names a local variable:
defouter():
i=3@pyscript_compiledefinner(x=i):
returnx*10returninner()
outer()
# TypeError: unsupported operand type(s) for *: 'EvalLocalVar' and 'int'# Python: 30
The function is compiled with exec() using the enclosing function's symbol table, where locals are kept in EvalLocalVar cells, so the default is evaluated to the cell itself. This is the same on 2.1.1 and 3.0.0. Found while reviewing #942.
Activity