mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
gh-74929: Remove undesirable DECREF in PEP 667 implementation (#118583)
With tests.
This commit is contained in:
parent
1b22d801b8
commit
5dd36732c8
2 changed files with 15 additions and 1 deletions
|
@ -364,6 +364,21 @@ class TestFrameLocals(unittest.TestCase):
|
|||
c = 0
|
||||
f()
|
||||
|
||||
def test_local_objects(self):
|
||||
o = object()
|
||||
k = '.'.join(['a', 'b', 'c'])
|
||||
f_locals = sys._getframe().f_locals
|
||||
f_locals['o'] = f_locals['k']
|
||||
self.assertEqual(o, 'a.b.c')
|
||||
|
||||
def test_update_with_self(self):
|
||||
def f():
|
||||
f_locals = sys._getframe().f_locals
|
||||
f_locals.update(f_locals)
|
||||
f_locals.update(f_locals)
|
||||
f_locals.update(f_locals)
|
||||
f()
|
||||
|
||||
def test_repr(self):
|
||||
x = 1
|
||||
# Introduce a reference cycle
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue