Add test to verify that nested functions with free variables don't
cause the free variables to leak.
diff --git a/Lib/test/test_scope.py b/Lib/test/test_scope.py
index 0633b14..4bd8ed7 100644
--- a/Lib/test/test_scope.py
+++ b/Lib/test/test_scope.py
@@ -383,3 +383,26 @@
return g()
verify(f() == 2)
verify(x == 2)
+
+print "16. check leaks"
+
+class Foo:
+ count = 0
+
+ def __init__(self):
+ Foo.count += 1
+
+ def __del__(self):
+ Foo.count -= 1
+
+def f1():
+ x = Foo()
+ def f2():
+ return x
+ f2()
+
+for i in range(100):
+ f1()
+
+verify(Foo.count == 0)
+