Hi,

I noticed two failures to compile that I think are bugs:
 - "ctypedef Foo[int] Bar" gives a syntax error (i.e., there doesn't seem to
be any way to typedef a templated type).
 - Defining a struct in a namespace and trying to convert it to a Python
dict doesn't work. Instead you get nasty "__pyx_convert__to_py_THENAMESPACE"
errors from the C++ compiler (it doesn't mangle the cname properly and tries
to define __pyx_convert__to_py_THENAMESPACE::THESTRUCT).

I made a patch to *add tests* for the two bugs (not fix them).

(BTW, is creating Trac tickets closed to the general public?)

David
diff -r cdc916b64a1f tests/compile/cpp_structs.pyx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/compile/cpp_structs.pyx	Thu May 13 11:46:03 2010 -0400
@@ -0,0 +1,9 @@
+cdef extern from "point.h" namespace "geometry":
+
+    cdef struct Point:
+        double x
+        double y
+        int color
+
+cdef Point p = Point(0.0, 0.0, 0)
+the_point = p
diff -r cdc916b64a1f tests/compile/cpp_templated_ctypedef.pyx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/compile/cpp_templated_ctypedef.pyx	Thu May 13 11:46:03 2010 -0400
@@ -0,0 +1,4 @@
+cdef extern from *:
+    cdef cppclass Foo[T]:
+        pass
+    ctypedef Foo[int] IntFoo
diff -r cdc916b64a1f tests/compile/point.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/compile/point.h	Thu May 13 11:46:03 2010 -0400
@@ -0,0 +1,14 @@
+#ifndef POINT_H
+#define POINT_H
+
+namespace geometry {
+    
+    struct Point
+    {
+        double x;
+        double y;
+        int color;
+    };
+}
+
+#endif
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to