summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormattip <matti.picus@gmail.com>2018-11-13 17:52:31 -0800
committermattip <matti.picus@gmail.com>2018-11-13 17:52:31 -0800
commit07aaffae35fc15992657662f495968191cbfcaef (patch)
tree1f6515fbaa17431232e28e633eedf0c433407708
parenta6ec7fb9a6350611394a8955096df7f81238af5d (diff)
downloadcython-07aaffae35fc15992657662f495968191cbfcaef.tar.gz
BUG: fix test to use correct macros, functions for c-level getters
-rw-r--r--tests/run/ext_attr_getter.srctree30
1 files changed, 15 insertions, 15 deletions
diff --git a/tests/run/ext_attr_getter.srctree b/tests/run/ext_attr_getter.srctree
index 314c41aa5..2cfc30191 100644
--- a/tests/run/ext_attr_getter.srctree
+++ b/tests/run/ext_attr_getter.srctree
@@ -38,23 +38,23 @@ typedef struct {
} FooStructOpaque;
-#define PyFoo_GET0(a) a.f0
-#define PyFoo_GET1(a) a.f1
-#define PyFoo_GET2(a) a.f2
+#define PyFoo_GET0M(a) ((FooStructNominal*)a)->f0
+#define PyFoo_GET1M(a) ((FooStructNominal*)a)->f1
+#define PyFoo_GET2M(a) ((FooStructNominal*)a)->f2
-int PyFoo_Get0(FooStructNominal f)
+int PyFoo_Get0F(FooStructOpaque *f)
{
- return f.f0;
+ return ((FooStructNominal*)f)->f0;
}
-int PyFoo_Get1(FooStructNominal f)
+int PyFoo_Get1F(FooStructOpaque *f)
{
- return f.f1;
+ return ((FooStructNominal*)f)->f1;
}
-int PyFoo_Get2(FooStructNominal f)
+int PyFoo_Get2F(FooStructOpaque *f)
{
- return f.f2;
+ return ((FooStructNominal*)f)->f2;
}
#ifdef __cplusplus
@@ -124,19 +124,19 @@ cdef extern from "foo.h":
ctypedef class foo_extension.Foo [object FooStructOpaque, check_size ignore]:
@property
cdef int field0(self):
- return PyFoo_GET0(self)
+ return PyFoo_GET0M(self)
@property
cdef int field1(self):
- return PyFoo_Get1(self)
+ return PyFoo_Get1F(self)
@property
cdef int field2(self):
- return PyFoo_GET2(self)
+ return PyFoo_GET2M(self)
- int PyFoo_GET0(Foo); # this is actually a macro !
- int PyFoo_Get1(Foo);
- int PyFoo_GET2(Foo); # this is actually a macro !
+ int PyFoo_GET0M(Foo); # this is actually a macro !
+ int PyFoo_Get1F(Foo);
+ int PyFoo_GET2M(Foo); # this is actually a macro !
def sum(Foo f):
# Note - not a cdef function but compiling the f.__getattr__('field0')