summaryrefslogtreecommitdiff
path: root/tests/run/exttype_gc.pyx
diff options
context:
space:
mode:
Diffstat (limited to 'tests/run/exttype_gc.pyx')
-rw-r--r--tests/run/exttype_gc.pyx38
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/run/exttype_gc.pyx b/tests/run/exttype_gc.pyx
new file mode 100644
index 000000000..db8ae2cc9
--- /dev/null
+++ b/tests/run/exttype_gc.pyx
@@ -0,0 +1,38 @@
+# mode: run
+# tag: gc
+
+
+def create_obj(cls):
+ cls() # create and discard
+
+
+cdef class BaseTypeNoGC:
+ pass
+
+
+cdef class ExtTypeGC(BaseTypeNoGC):
+ """
+ >>> create_obj(ExtTypeGC)
+ >>> create_obj(ExtTypeGC)
+ >>> create_obj(ExtTypeGC)
+
+ >>> class PyExtTypeGC(ExtTypeGC): pass
+ >>> create_obj(PyExtTypeGC)
+ >>> create_obj(PyExtTypeGC)
+ >>> create_obj(PyExtTypeGC)
+ """
+ cdef object attr
+
+
+cdef class ExtTypeNoGC(BaseTypeNoGC):
+ """
+ >>> create_obj(ExtTypeNoGC)
+ >>> create_obj(ExtTypeNoGC)
+ >>> create_obj(ExtTypeNoGC)
+
+ >>> class PyExtTypeNoGC(ExtTypeNoGC): pass
+ >>> create_obj(PyExtTypeNoGC)
+ >>> create_obj(PyExtTypeNoGC)
+ >>> create_obj(PyExtTypeNoGC)
+ """
+ cdef int x