Dear Dimitri,

Sorry for the delay, many developers are busy with their lives. Thanks
for the report, it think that this was broken in
464923673475879fedc103ef2ee0260ba88d1493, the culprit is
https://github.com/cython/cython/blob/master/Cython/Compiler/ExprNodes.py#L603
, I think it should read 'if dst_type.is_reference and not
self.type.is_reference:'. If you want you could substitute that line
with this line and write a simple test and make a new pull request, we
will merge it.

Cheers,

Mark

On 15 January 2012 18:01, Dimitri Tcaciuc <dtcac...@gmail.com> wrote:
> Hi folks,
>
> Since the original question, I've created a pull request with a
> failing test and tried to get some discussion going, but so far no
> answer. I'm a tad discouraged, since obviously there's movement on
> mail list and with pull requests. Is a pull request a proper way to do
> this? I completely understand if you guys don't have enough available
> time to deal with it right now, however at least some acknowledgement
> and feedback would be much appreciated.
>
> Thanks,
>
>
> Dimitri.
>
> On Sun, Dec 18, 2011 at 8:17 PM, Dimitri Tcaciuc <dtcac...@gmail.com> wrote:
>> Hello everyone,
>>
>> Here's a small test case I'm trying to compile. I'm trying to pass a
>> STL set reference to a method in a template class.
>>
>> x.pyx:
>>
>>    from libcpp.set cimport set as cpp_set
>>
>>    cdef extern from "x.hh":
>>
>>        cdef cppclass Foo [T]:
>>            Foo()
>>            void set_x(cpp_set[size_t] & x)
>>
>>    cpdef func():
>>        cdef Foo[int] foo
>>
>>        cdef cpp_set[size_t] x
>>        cdef cpp_set[size_t] & xref = x
>>
>>        foo.set_x(xref)
>>
>> x.hh:
>>
>>    #include <set>
>>
>>    template <typename T>
>>    struct Foo {
>>        void set_x(const std::set<size_t> & x) { /* do nothing */ }
>>    };
>>
>> To compile,
>>
>>    bash $ cython --cplus x.pyx
>>
>> Which results in
>>
>>    foo.set_x(xref)
>>                 ^
>> ------------------------------------------------------------
>> x.pyx:15:18: Cannot assign type 'set<size_t> &' to 'set<size_t>'
>>
>>
>> However, if I remove the template parameter from Foo, everything works.
>>
>>
>> y.pyx:
>>
>>    from libcpp.set cimport set as cpp_set
>>
>>    cdef extern from "y.hh":
>>
>>        cdef cppclass Foo:
>>            Foo()
>>            void set_x(cpp_set[size_t] & x)
>>
>>    cpdef func():
>>        cdef Foo foo
>>
>>        cdef cpp_set[size_t] x
>>        cdef cpp_set[size_t] & xref = x
>>
>>        foo.set_x(xref)
>>
>> y.hh:
>>
>>    #include <set>
>>
>>    struct Foo {
>>        void set_x(const std::set<size_t> & x) { /* do nothing */ }
>>    };
>>
>>
>> From what I can tell, the CppClassType instance the CReferenceType is
>> pointing to has the correct name "set<size_t>", however it's a
>> different class instance. The particular failing expression is in
>> `ExprNode.coerce_to`
>>
>>    if not (str(src.type) == str(dst_type) or
>> dst_type.assignable_from(src_type))
>>
>>
>> I wish I could suggest a patch, but unfortunately I'm a complete
>> newbie to Cython internals. Perhaps someone could give a few pointers
>> as to what should be done to fix this?
>>
>> Thanks,
>>
>>
>> Dimitri
> _______________________________________________
> cython-devel mailing list
> cython-devel@python.org
> http://mail.python.org/mailman/listinfo/cython-devel
_______________________________________________
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel

Reply via email to