From a7f25564bd8e438797c87751f02cced63fea494a Mon Sep 17 00:00:00 2001 From: Dag Sverre Seljebotn Date: Wed, 6 May 2009 20:46:36 +0200 Subject: [PATCH] Testcases for #303 --- tests/run/external_defs.h | 3 +++ tests/run/typedfieldbug_T303.pyx | 20 ++++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 tests/run/external_defs.h create mode 100644 tests/run/typedfieldbug_T303.pyx diff --git a/tests/run/external_defs.h b/tests/run/external_defs.h new file mode 100644 index 00000000..a6f22cf0 --- /dev/null +++ b/tests/run/external_defs.h @@ -0,0 +1,3 @@ + + +typedef double DoubleTypedef; diff --git a/tests/run/typedfieldbug_T303.pyx b/tests/run/typedfieldbug_T303.pyx new file mode 100644 index 00000000..5db65860 --- /dev/null +++ b/tests/run/typedfieldbug_T303.pyx @@ -0,0 +1,20 @@ +""" +>>> f() +42.0 42.0 +""" + +cdef extern from "external_defs.h": + ctypedef float DoubleTypedef + +cdef class MyClass: + cdef readonly: + double var_d + DoubleTypedef var_nf + def __init__(self): + self.var_d = 42.0 + self.var_nf = 42.0 + +def f(): + c = MyClass() + print c.var_d, c.var_nf + -- 2.26.2