Message297503
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) | |
| Date | User | Action | Args | | 2017-07-02 02:53:01 | ncoghlan | set | recipients: + ncoghlan, arigo, belopolsky, vstinner, benjamin.peterson, njs, xdegaye, Mark.Shannon, yselivanov, xgdomingo | | 2017-07-02 02:53:01 | ncoghlan | set | messageid: <1498963981.07.0.0534225847653.issue30744@psf.upfronthosting.co.za> | | 2017-07-02 02:53:01 | ncoghlan | link | issue30744 messages | | 2017-07-02 02:52:59 | ncoghlan | create | | |