On Feb 9, 2010, at 1:18 AM, Stefan Behnel wrote:

> 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.
>
> The second error I got says: "Invalid conversion from 'Python  
> object' to
> 'double'", which is something that should *always* work. I get the  
> same
> error for other numeric types in other tests. Looks like Python object
> conversion is broken in cython-devel.
>
> It seems to me that the new C++ support is lacking a lot of important
> tests.

There is a *huge* deficiency in testing, and nearly every time I write  
a test I find bugs to fix. That's why it has been sitting so long. But  
there's a lot of working stuff in there too.

There's some refactoring I intend to do both in parsing and analysis,  
as the current system doesn't always work.

> I added a naming convention to the test runner that finds related
> ".c" and ".cpp" source files in the same test directory if they  
> start with
> the module name plus an underscore, i.e. a set of files like this:
>
> cppwrap_lib.cpp
> cppwrap_lib.h
> cppwrap_lib.pxd
> cppwrap.pyx
>
> will create a module based on the source files "cppwrap.cpp" and
> "cppwrap_lib.cpp". That should make it easy enough to write tests for
> wrapper code.

Nice.

- Robert

_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to