summaryrefslogtreecommitdiff
path: root/tests/run/decorators.pyx
diff options
context:
space:
mode:
Diffstat (limited to 'tests/run/decorators.pyx')
-rw-r--r--tests/run/decorators.pyx20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/run/decorators.pyx b/tests/run/decorators.pyx
index 85834eb8b..54623e0cb 100644
--- a/tests/run/decorators.pyx
+++ b/tests/run/decorators.pyx
@@ -61,3 +61,23 @@ a = A()
@a.decorate
def i(x):
return x - 1
+
+def append_to_list_decorator(lst):
+ def do_append_to_list_dec(func):
+ def new_func():
+ return lst + func()
+ return new_func
+ return do_append_to_list_dec
+
+def outer(arg1, arg2):
+ """
+ ensure decorators are analysed in the correct scope
+ https://github.com/cython/cython/issues/4367
+ mainly intended as a compile-time test (but it does run...)
+ >>> outer(append_to_list_decorator, [1,2,3])
+ [1, 2, 3, 4]
+ """
+ @arg1([x for x in arg2])
+ def method():
+ return [4]
+ return method()