You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Make frame.f_locals.copy() return a snapshot dict of f_locals #118921
Per PEP 667, frame.f_locals is now a write-through proxy (FrameLocalsProxy) for underlying fast local variables. In the beginning we did not implement the copy() method because we think dict(frame.f_locals) is a more explicit way to achieve the snapshot. However, there are existing code that's using frame.f_locals.copy() to take a snapshot. Moreover, types.MappingProxyType({}).copy() returns the copy of the underlying mapping so it's not unprecedented for a proxy.copy() to return a dict.
Thus, we should implement copy() method for FrameLocalsProxy and make it return a dict of snapshot of the current local variables.
Has this already been discussed elsewhere?
I have already discussed this feature proposal on Discourse
Activity
gh-118921: Add `copy()` method for `FrameLocalsProxy` (#118923)
pythongh-118921: Add `copy()` method for `FrameLocalsProxy` (pythonGH…
[3.13] gh-118921: Add `copy()` method for `FrameLocalsProxy` (GH-118923…
fix(tests): Fix exception on copying `frame.f_locals` (Python 3.13)
fix(tests): Fix exception on copying `frame.f_locals` (Python 3.13)
fix(tests): Fix exception on copying `frame.f_locals` (Python 3.13) (#…
feat: Preliminary support for Python 3.13 (#3200)
pythongh-118921: Add `copy()` method for `FrameLocalsProxy` (python#1…
feat: Preliminary support for Python 3.13 (getsentry#3200)
feat: Preliminary support for Python 3.13 (getsentry#3200)
feat: Preliminary support for Python 3.13 (getsentry#3200)
feat: Preliminary support for Python 3.13 (getsentry#3200)