cython/cython — pull request #335 by BigFav (2014-11-19 03:05:14+00:00)
Title: Generate warning when Python object is used as C++ container reference parameter.

This is in response to ticket 838, and this post: https://groups.google.com/forum/#!topic/cython-users/ol4ih5DrL9Y

I had trouble inserting my test cases into the test suite. Here they are:
```
# mode: error
# tag: werror

from libcpp.set cimport set

cdef extern from "s_interface.cpp":
void cpp_function_set1(set[int])
void cpp_function_set2(set[int] &)

def pass_py_obj_as_cpp_cont_ref():
cdef list ordered_set = [0, 0, 0, 0, 0]
cpp_function_set1(ordered_set)
cpp_function_set2(ordered_set)

_ERRORS = """
14:33: Cannot pass Python object as set[int] reference, will pass by copy.
"""
```
and I did not attempt to insert the next one since it is strictly more complicated.
```
import numpy as np
cimport numpy as np
from libcpp.vector cimport vector

cdef extern from "v_interface.cpp":
void cpp_function_vector1(vector[int])
void cpp_function_vector2(vector[int] &)
void cpp_function_2_vec_refs(vector[int] &, vector[int] &)

def main():
cdef np.ndarray[int, ndim=1, mode="c"] arr = np.zeros(10, dtype='intc')
cpp_function_vector1(arr)
cpp_function_vector2(arr)
cpp_function_vector2(arr)
cpp_function_2_vec_refs(arr, arr)

cdef vector[int] vec
vec.push_back(0)
cpp_function_vector2(vec)
```
I also added code that only works in Python 2 (PyrexTypes: 3376), I will change this if necessary.