Reassignment of retained vars within one repl invocation causes UnboundLocalError #57
Open
4 tasks done
Labels
bug
no acceptable impl
no known implementation that suitably satisfies the conditions of closure within standards
Summary
Reassignment of retained variables causes UnboundLocalError
Reproduction steps
jsk retain 1
jsk py x = 1
jsk py x = x + 1
Expected results
x is reassigned to 2.
Actual results
Checklist
System information
Remarks
This is apparently due to x being a global name. Ideally we could pass in locals to the user-defined code, but this is not possible, even with PyCF_ALLOW_TOP_LEVEL_AWAIT. Fixing this might require transforming all name lookups to
globals()['x'] if x in globals() else x
.The text was updated successfully, but these errors were encountered: