Message296882
I updated the old "we should clarify the semantics" issue with a more concrete update proposal: https://bugs.python.org/issue17960#msg296880
Essentially nothing would change for module and class scopes, but the proposal for function scopes is that locals() be changed to return "frame.f_locals.copy()" rather than a direct reference to the original.
Nothing would change for tracing functions (since they already access frame.f_locals directly), but the current odd side-effect that setting a trace function has on the result of normal locals() calls would go away.
Folks that actually *wanted* the old behaviour would then need to do either "sys._getframe().f_locals" or "inspect.currentframe().f_locals".
However, none of that would help with *this* issue: resolving the bug here would still require either a modification that allowed PyFrame_LocalsToFast to only write back those values that had been rebound since the preceding call to PyFrame_FastToLocals (ma_version_tag could help with doing that efficiently), or else a decision to disallow write-backs to frame locals even from tracing functions in 3.7+. |
|
Date |
User |
Action |
Args |
2017-06-26 12:02:36 | ncoghlan | set | recipients:
+ ncoghlan, arigo, belopolsky, benjamin.peterson, njs, Mark.Shannon, yselivanov, xgdomingo |
2017-06-26 12:02:36 | ncoghlan | set | messageid: <1498478556.81.0.256845898905.issue30744@psf.upfronthosting.co.za> |
2017-06-26 12:02:36 | ncoghlan | link | issue30744 messages |
2017-06-26 12:02:36 | ncoghlan | create | |
|