Add testcase for cdef class method with closure
authorVitja Makarov <vitja.makarov@gmail.com>
Wed, 30 Mar 2011 08:46:48 +0000 (10:46 +0200)
committerVitja Makarov <vitja.makarov@gmail.com>
Wed, 30 Mar 2011 08:46:48 +0000 (10:46 +0200)
tests/run/closure_self.pyx [new file with mode: 0644]

diff --git a/tests/run/closure_self.pyx b/tests/run/closure_self.pyx
new file mode 100644 (file)
index 0000000..78c544e
--- /dev/null
@@ -0,0 +1,11 @@
+cdef class SelfInClosure(object):
+    """
+    >>> o = SelfInClosure()
+    >>> o.closure_method()() == o
+    True
+    """
+
+    def closure_method(self):
+        def nested():
+            return self
+        return nested