[Cython] non-template nested C++ classes

Simon Anders anders at embl.de
Thu Jan 19 21:10:47 CET 2012


Hi,

I'm currently experimenting with Cython's support for nested C++ classes 
and might havce encountered a bug.

I have attempted to strip down the example from the documentation to its 
bare minimum. This here works fine:

---8<---
cdef extern from "foo":
     cdef cppclass outer[T]:
         cppclass inner:
            pass

cdef outer[int].inner foo
---8<---

Next, I remove the template parameter as well. After all, not every 
outer class containing an inner class is a template class.

---8<---
cdef extern from "foo":
     cdef cppclass outer:
         cppclass inner:
            pass

cdef outer.inner foo
---8<---

Now, I get this error message:
    'outer' is not a cimported module

It seems that without the square brackets, Cython no longer recognizes 
'outer' as a class name and thinks it must be a module because it is 
followed by a dot. I suppose this is not what should happen, right?

Best regards
   Simon


More information about the cython-devel mailing list