我需要在cdef函数中将int列表的Python列表转换为vector [int]以调用另一个C函数。我尝试这样做:在Python中将Python列表转换为向量<int>
cdef pylist_to_handles(hs):
cdef vector[int] o_vect
for h in hs:
o_vect.push_back(h)
return o_vect
这应该工作,因为我只需要从其它CDEF函数调用它,我得到这个错误:
Cannot convert 'vector<int>' to Python object
我在做什么错?