From: Robert Bradshaw Date: Tue, 5 Oct 2010 04:02:55 +0000 (-0700) Subject: Test for broken reference coercion - #581. X-Git-Tag: 0.14.alpha0~299 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=3cf1d712b6468c4175f2b6b5347f77cf114ffdf7;p=cython.git Test for broken reference coercion - #581. --- diff --git a/tests/run/libcpp_all.pyx b/tests/run/libcpp_all.pyx index 8ab5192d..5eaf009e 100644 --- a/tests/run/libcpp_all.pyx +++ b/tests/run/libcpp_all.pyx @@ -53,3 +53,15 @@ cdef vector[int].iterator iv1 = v1.begin() cdef vector[int].iterator iv2 = v1.end() cdef vector[int].reverse_iterator riv1 = v1.rbegin() cdef vector[int].reverse_iterator riv2 = v1.rend() + +def test_vector_coercion(*args): + """ + >>> test_vector_coercion(1.75) + [1.75] + >>> test_vector_coercion(1, 10, 100) + [1.0, 10.0, 100.0] + """ + v = new vector[double]() + for a in args: + v.push_back(a) + return [v[0][i] for i in range(v.size())]