mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
Do not clear globals or builtins when calling clear() on a frame object. Reverts behavior to that of 3.10 and earlier. (GH-26768)
This commit is contained in:
parent
00710e6346
commit
ba2f32a983
2 changed files with 17 additions and 5 deletions
|
@ -45,6 +45,19 @@ class ClearTest(unittest.TestCase):
|
|||
# The reference was released by .clear()
|
||||
self.assertIs(None, wr())
|
||||
|
||||
def test_clear_does_not_clear_specials(self):
|
||||
class C:
|
||||
pass
|
||||
c = C()
|
||||
exc = self.outer(c=c)
|
||||
del c
|
||||
f = exc.__traceback__.tb_frame
|
||||
f.clear()
|
||||
self.assertIsNot(f.f_code, None)
|
||||
self.assertIsNot(f.f_locals, None)
|
||||
self.assertIsNot(f.f_builtins, None)
|
||||
self.assertIsNot(f.f_globals, None)
|
||||
|
||||
def test_clear_generator(self):
|
||||
endly = False
|
||||
def g():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue