-
-
Notifications
You must be signed in to change notification settings - Fork 30.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
it's no longer possible to delete items from f_locals (FrameLocalsProxy) in 3.13+ #125590
Comments
This sounds like an issue in the version of I assume it's related to the FrameLocalsProxy changes from PEP-667; cc @gaogaotiantian. |
Maybe |
problem is you cannot remove items from FrameLocalsProxy: Line 162 in d83fcf8
I think pydevd has to do try:
del frame.f_locals["__exception__"]
except KeyError:
pass
except TypeError:
frame.f_locals["__exception__"] = None |
The reason why @markshannon and @gvanrossum as this was the discussion result from PEP 667 implementation. |
I'm not particularly familiar with how PEP 667 was implemented. From my understanding, deleting from |
Popping and deleting keys in the "extras" dict should be fine. In the style of the PEP, this would give us: def __delitem__(self, name):
del self._extra_locals[name]
def pop(self, name, default):
return self._extra_locals.pop(name, default) |
The semantics of |
Let's allow popping and deleting keys in extras, and generate an exception (we are generating one now on |
how do you generate the warning? I tried this on 3.12 and didn't see a warning, and the local didn't get set to None: import sys
class A:
pass
def foo():
a = A()
f_locals = sys._getframe().f_locals
del f_locals['a']
print(a)
print(f_locals)
foo()
|
This is the case where the |
Hello. Just checking back on this bug. Is there a plan to fix it and update the current Python 3.13 version with the fix? If so, when is that expected so I can reinstall Python 3.13? Thanks. |
The fix is in #125590 and it should be merged soon. We don't update the current version of 3.13, so 3.13.0 will be always like this without the fix. However, 3.13.1 should come up with the fix. It's estimated to be released two months after 3.13.0 so probably December. |
…xtra locals (pythonGH-125616) (cherry picked from commit 5b7a872) Co-authored-by: Tian Gao <[email protected]>
Bug report
Bug description:
In the example script above, if the code falls into the except: pass block due to an alert not being displayed, the script will ultimately fail (even if no coding errors are encountered) with FAILED (errors=1) .
Also, the following messages will be displayed in the output:
This code works fine in Python 3.12. The script succeeds with message OK and none of the above error messages. We can't move to 3.13 version until this is fixed.
CPython versions tested on:
3.13
Operating systems tested on:
Windows
Linked PRs
The text was updated successfully, but these errors were encountered: