Commit e8521a59 authored by Robert Bradshaw's avatar Robert Bradshaw

Fix vector to memview cast.

parent 4388e681
...@@ -4324,6 +4324,8 @@ def c_ptr_type(base_type): ...@@ -4324,6 +4324,8 @@ def c_ptr_type(base_type):
# Construct a C pointer type. # Construct a C pointer type.
if base_type is error_type: if base_type is error_type:
return error_type return error_type
elif base_type.is_reference:
return CPtrType(base_type.ref_base_type)
else: else:
return CPtrType(base_type) return CPtrType(base_type)
......
# mode: run
# tag: cpp
from libcpp.vector cimport vector
def memview_test(L, int i, int x):
"""
>>> memview_test(range(10), 7, 100)
[0, 1, 2, 3, 4, 5, 6, 100, 8, 9]
"""
cdef vector[int] v = L
cdef int[::1] mv = <int[:len(L)]> &v[0]
mv[i] = x
return v
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment