Ulrich Dobramysl wrote:

Thanks! I haven't figured out how to call heap allocated objects, as the code
---
cdef OperatorTest *t = new OperatorTest()
t()
---
is not translatable by Cython.

Have you tried:

   t[0]()

?

A quick and dirty fix for this would be this patch for NameNode.calculate_result_code:
---
diff --git a/Cython/Compiler/ExprNodes.py b/Cython/Compiler/ExprNodes.py
index f99ec6e..f894a64 100644
--- a/Cython/Compiler/ExprNodes.py
+++ b/Cython/Compiler/ExprNodes.py
@@ -1904,6 +1904,8 @@ class NameNode(AtomicExprNode):
         entry = self.entry
         if not entry:
             return "<error>" # There was an error earlier
+        if entry.cname=='operator()':
+            return self.name <http://self.name>
         return entry.cname

I haven't been following the development of Cython's internals,
so I may be speaking naively here, but it looks wrong to me that
the cname of that entry should be 'operator()' rather than the
c-level name of the variable that the NameNode refers to.

--
Greg
_______________________________________________
cython-devel mailing list
cython-devel@python.org
https://mail.python.org/mailman/listinfo/cython-devel

Reply via email to