From 140c40d45a0fec2883de877b5fd1a0e3e36f0c3f Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Sat, 23 Nov 2013 21:26:19 +0100 Subject: [PATCH] make an old test from 'broken' directory usable --HG-- rename : tests/broken/voidstarcast.pyx => tests/run/voidstarcast.pyx --- tests/broken/voidstarcast.pyx | 12 ------------ tests/run/voidstarcast.pyx | 28 ++++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 12 deletions(-) delete mode 100644 tests/broken/voidstarcast.pyx create mode 100644 tests/run/voidstarcast.pyx diff --git a/tests/broken/voidstarcast.pyx b/tests/broken/voidstarcast.pyx deleted file mode 100644 index ea66be0..0000000 --- a/tests/broken/voidstarcast.pyx +++ /dev/null @@ -1,12 +0,0 @@ -cdef class C: - cdef int i - -cdef int f() except -1: - cdef object x - cdef void *p - cdef int i - x = p - p = x - x = (p).foo - i = (p).i - (p).i = i diff --git a/tests/run/voidstarcast.pyx b/tests/run/voidstarcast.pyx new file mode 100644 index 0000000..7455804 --- /dev/null +++ b/tests/run/voidstarcast.pyx @@ -0,0 +1,28 @@ +cdef class C: + cdef int i + + def foo(self): + self.i = 42 + + def get_i(self): + return self.i + + +def cast_cast_cast(arg): + """ + >>> x = C() + >>> x.foo() + >>> cast_cast_cast(x) == x + True + >>> x.get_i() + 42 + """ + cdef object x + cdef void *p = arg + cdef int i + x = p + p = x + x = (p).foo + i = (p).i + (p).i = i + return p -- 2.7.4