[issue30744] Local variable assignment is broken when combined with threads + tracing + closures
Nick Coghlan
report at bugs.python.org
Sat Jul 1 22:53:01 EDT 2017
Nick Coghlan added the comment:
As per the discussion in issue #17960, I'm going to put together a short PEP about this topic for Python 3.7 that will better specify the expected behaviour of locals() and frame.f_locals.
That will be a combination of making the status quo official, proposing some changes, and asking Guido for a design decision.
Documenting the status quo: make the current behaviour at module scope, class scope, and the corresponding behaviours of exec and eval officially part of the status quo
Proposing a change: replacing the current LocalsToFast approach with a custom write-through proxy type that updates the locals array and nonlocal cell variables immediately whenever frame.f_locals is modified (this is the part that should fix the bug reported in this issue)
Requesting a design decision: whether locals() at function(/generator/coroutine) scope should return:
- a direct reference to the write-through proxy
- a live read-only dict-proxy (ala class __dict__ attributes)
- a point-in-time snapshot (i.e. copying the namespace)
----------
assignee: -> ncoghlan
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30744>
_______________________________________
More information about the Python-bugs-list
mailing list