summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_scope.py
diff options
context:
space:
mode:
authorAmaury Forgeot d'Arc <amauryfa@gmail.com>2008-07-21 22:00:38 (GMT)
committerAmaury Forgeot d'Arc <amauryfa@gmail.com>2008-07-21 22:00:38 (GMT)
commite4921fec0140da8c64f9e694904a7d709de745b4 (patch)
treecbbb3c3303bc1567a09bb57cae33111f899d20b7 /Lib/test/test_scope.py
parent90d07171637b9f218828265bddb1c0a63f5b9403 (diff)
downloadcpython-e4921fec0140da8c64f9e694904a7d709de745b4.zip
cpython-e4921fec0140da8c64f9e694904a7d709de745b4.tar.gz
cpython-e4921fec0140da8c64f9e694904a7d709de745b4.tar.bz2
Issue2378: pdb would delete free variables when stepping into a class statement.
The problem was introduced by r53954, the correction is to restore the symmetry between PyFrame_FastToLocals and PyFrame_LocalsToFast
Diffstat (limited to 'Lib/test/test_scope.py')
-rw-r--r--Lib/test/test_scope.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/Lib/test/test_scope.py b/Lib/test/test_scope.py
index cd2d98c..3914ed0 100644
--- a/Lib/test/test_scope.py
+++ b/Lib/test/test_scope.py
@@ -519,6 +519,24 @@ self.assert_(X.passed)
self.assert_("x" not in varnames)
self.assert_("y" in varnames)
+ def testLocalsClass_WithTrace(self):
+ # Issue23728: after the trace function returns, the locals()
+ # dictionary is used to update all variables, this used to
+ # include free variables. But in class statements, free
+ # variables are not inserted...
+ import sys
+ sys.settrace(lambda a,b,c:None)
+ try:
+ x = 12
+
+ class C:
+ def f(self):
+ return x
+
+ assert x == 12 # Used to raise UnboundLocalError
+ finally:
+ sys.settrace(None)
+
def testBoundAndFree(self):
# var is bound and free in class