[Cython] cython crash: default parameters in methods of template cppclass

Simon Anders anders at embl.de
Tue Mar 22 15:34:02 CET 2011


I found a little bug in Cython 0.14.1.

The following causes the Cython compiler to throw an exception:

cdef extern from "foo.h":
     cdef cppclass foo[ T ]:
        bar( int b = 0 )

cdef foo[ int ] a
a.bar( 1 )

The exception is "AttributeError: 'CFuncType' object has no attribute 
'op_arg_struct'", thrown in line 3044, in generate_result_code. Full 
stack trace attached.

The file compiles without crash if one either
   - removes the last line, i.e. the call to the class's method, or
   - removes the template argument, i.e., the "[ T ]" in line 2 and
        the "[ int ]" in line 5.

Hence, the issue only appears when calling methods of _templated_ 
classes, which have a _default_ value for their argument.


| Dr. Simon Anders, Dipl.-Phys.
| European Molecular Biology Laboratory (EMBL), Heidelberg
| office phone +49-6221-387-8632
| preferred (permanent) e-mail: sanders at fs.tum.de

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: trace
URL: <http://mail.python.org/pipermail/cython-devel/attachments/20110322/d5ca3834/attachment.ksh>

More information about the cython-devel mailing list