test case for locals(), ticket 429
authorStefan Behnel <scoder@users.berlios.de>
Wed, 21 Oct 2009 13:57:41 +0000 (15:57 +0200)
committerStefan Behnel <scoder@users.berlios.de>
Wed, 21 Oct 2009 13:57:41 +0000 (15:57 +0200)
tests/bugs.txt
tests/run/locals_rebind_T429.pyx [new file with mode: 0644]

index 58205179cf7cbec06a98104c191a51931362fc09..7a0f2b197153f1f7bf68441d7e2394c84f26887b 100644 (file)
@@ -8,3 +8,4 @@ unsignedbehaviour_T184
 bad_c_struct_T252
 missing_baseclass_in_predecl_T262
 extended_unpacking_T409
+locals_rebind_T429
diff --git a/tests/run/locals_rebind_T429.pyx b/tests/run/locals_rebind_T429.pyx
new file mode 100644 (file)
index 0000000..d692311
--- /dev/null
@@ -0,0 +1,25 @@
+__doc__ = u"""
+>>> sorted( get_locals(1,2,3, k=5) .items())
+[('args', (2, 3)), ('kwds', {'k': 5}), ('x', 1), ('y', 'hi'), ('z', 5)]
+
+>>> get_locals_rebound(1,2,3)
+'REBOUND'
+"""
+
+def get_locals(x, *args, **kwds):
+    cdef int z = 5
+    y = "hi"
+    return locals()
+
+def get_locals_rebound(x, *args, **kwds):
+    cdef int z = 5
+    locals = _locals
+    y = "hi"
+    return locals()
+
+def _locals(): return "REBOUND"
+
+def sorted(it):
+    l = list(it)
+    l.sort()
+    return l