This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ncoghlan
Recipients Mark.Shannon, arigo, belopolsky, benjamin.peterson, ncoghlan, njs, xgdomingo, yselivanov
Date 2017-06-26.12:02:36
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
I updated the old "we should clarify the semantics" issue with a more concrete update proposal:

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:36ncoghlansetrecipients: + ncoghlan, arigo, belopolsky, benjamin.peterson, njs, Mark.Shannon, yselivanov, xgdomingo
2017-06-26 12:02:36ncoghlansetmessageid: <>
2017-06-26 12:02:36ncoghlanlinkissue30744 messages
2017-06-26 12:02:36ncoghlancreate