Vitja Makarov, 24.07.2012 18:42: > 2012/7/24 Stefan Behnel: >> Vitja Makarov, 24.07.2012 14:48: >>> 2012/7/24 Stefan Behnel: >>>> Stefan Behnel, 24.07.2012 12:43: >>>>> Vitja Makarov, 23.07.2012 07:13: >>>>>> Here is part of original testcase: >>>>>> >>>>>> from cython.operator cimport dereference as d >>>>>> from cython.operator cimport preincrement as incr >>>>>> from libcpp.vector cimport vector >>>>>> >>>>>> def reverse_iteration_test(L): >>>>>> v = new vector[int]() >>>>>> for a in L: >>>>>> v.push_back(a) >>>>>> it = v.rbegin() >>>>>> while it != v.rend(): >>>>>> a = d(it) >>>>>> incr(it) >>>>>> print(a) >>>>>> >>>>>> I think it's not correct to infer `a` as reverse_iterator because it's >>>>>> not an iterator it's vector's item. >>>>> >>>>> Right. DereferenceNode should implement infer_type(). >>>> >>>> ... and not only DereferenceNode. Pretty much all C++ operators do not >>>> properly implement type inference. I'll take a look. >>> >>> Ok, thanks! >> >> Here's my fix. >> >> https://github.com/cython/cython/commit/43f3d87d9760d3c7e7fa6a127d0bdaf549880621 >> >> It became a bit more involved than I had anticipated, including some >> cleanups and fixes for a couple of quirks that I ran into. >> >> It's really too bad that the Sage build is currently broken. The C++ code >> in there would be a good exercise for this change (even if it won't benefit >> from the type inference). At least, so far, it doesn't seem like it has >> broken more than what was broken before. > > And sorry for stupid question: do we support multiple overloaded > operators of the same kind?
I'm sure we're lacking a test for that. At least in the change above, I'm using "lookup_operator_for_types()", which should do the right thing. Stefan _______________________________________________ cython-devel mailing list cython-devel@python.org http://mail.python.org/mailman/listinfo/cython-devel