From 9b394998d6f8d7e73151481ea2203b7d7d4e15c2 Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Wed, 21 Oct 2009 15:57:41 +0200 Subject: [PATCH] test case for locals(), ticket 429 --- tests/bugs.txt | 1 + tests/run/locals_rebind_T429.pyx | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 tests/run/locals_rebind_T429.pyx diff --git a/tests/bugs.txt b/tests/bugs.txt index 58205179..7a0f2b19 100644 --- a/tests/bugs.txt +++ b/tests/bugs.txt @@ -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 index 00000000..d6923114 --- /dev/null +++ b/tests/run/locals_rebind_T429.pyx @@ -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 -- 2.26.2