9 Feb 17:01
Re: [Cython] C++ method overloading?
2010/2/9 Stefan Behnel <stefan_ml@...>: > > Robert Bradshaw, 08.02.2010 20:20: >> On Feb 8, 2010, at 10:57 AM, Robert Bradshaw wrote: >> >>> On Feb 8, 2010, at 7:33 AM, Stefan Behnel wrote: >>> >>>> The exact error depends on the order in which I declare the two >>>> methods. It >>>> seems that the last declaration wins. And Cython also doesn't >>>> complain >>>> about the constructor call right two methods above, so that seems to >>>> have >>>> worked. >>>> >>>> Is this supposed to work for regular C++ methods? >>> Yes, this should have worked. I'm surprised there aren't any tests for >>> this... >> >> OK, pushed a quick fix: http://hg.cython.org/cython-devel/rev/94c13764ba4a > > Ok, that got me past this problem. The next one was that I was using > > self.multiplier = testapi.Multiplier() > > by habit, instead of > > self.multiplier = new testapi.Multiplier() > > This lead to an "<error>" being generated in the code, but no error shown > on the output. > > After figuring that out, I got this: > > Error converting Pyrex file to C: > ------------------------------------------------------------ > ... > cdef class Multiplier: > cdef testapi.Multiplier* multiplier > > def __cinit__(self, factor=None): > if factor is None: > self.multiplier = new testapi.Multiplier() > ^ > ------------------------------------------------------------ > > .../pytestapi.pyx:9:54: Expected ')' > > Totally weird kind of error, given that it points to the closing > parenthesis already. We didn't used cimported C++ classes. I'll take a look at this. The problem is with the parser. It look at the first name and thinks it is a class name, and so, expect a '('. -- -- - Danilo Freitas
RSS Feed