[Cython] Compiler crash: forward declaration of cdef class with "public" attributes

Robert Bradshaw robertwb at gmail.com
Wed Jul 23 17:28:41 CEST 2014


On Wed, Jul 23, 2014 at 12:29 AM, Alok Singhal <gandalf013 at gmail.com> wrote:
> On Tue, Jul 22, 2014 at 11:42 PM, Robert Bradshaw <robertwb at gmail.com> wrote:
>> On Tue, Jul 8, 2014 at 4:34 PM, Alok Singhal <gandalf013 at gmail.com> wrote:
>>
>> Thanks. https://github.com/cython/cython/commit/967c8e11da94ddae1ea7f1524f6beef2e030c4d9
>
> Thanks for the fix!
>
>> FWIW, forward declarations should not generally be needed, and
>> certainly not needed if the class is already declared in a pxd file.
>
> I encountered this problem because we have a tool that generates .pxd
> files automatically from a .pyx file, and that tool ends up generating
> code like this in certain cases.
>
> Also, if forward declarations are not recommended, what is the best
> way to declare two cdef classes that need to know about each other?
> (Short of "don't do that!" :-) ).

Just do it without the forward declarations.

- Robert


More information about the cython-devel mailing list