]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Break a cycle created in the saboteur() function.
authorVladimir Marangozov <vladimir.marangozov@t-online.de>
Sat, 15 Jul 2000 00:42:09 +0000 (00:42 +0000)
committerVladimir Marangozov <vladimir.marangozov@t-online.de>
Sat, 15 Jul 2000 00:42:09 +0000 (00:42 +0000)
Lib/test/test_extcall.py

index 6cca1994712d00590ad7704a68964de552a081b9..de2312b1de3d83fb42a4346897ff93c4802ab63b 100644 (file)
@@ -85,10 +85,13 @@ assert d == d2, "function call modified dictionary"
 
 # what about willful misconduct?
 def saboteur(**kw):
-    kw['x'] = locals()
+    kw['x'] = locals() # yields a cyclic kw
+    return kw
 d = {}
-saboteur(a=1, **d)
+kw = saboteur(a=1, **d)
 assert d == {}
+# break the cycle
+del kw['x']
         
 try:
     g(1, 2, 3, **{'x':4, 'y':5})