Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
e8521a59
Commit
e8521a59
authored
Jul 30, 2015
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix vector to memview cast.
parent
4388e681
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
0 deletions
+16
-0
Cython/Compiler/PyrexTypes.py
Cython/Compiler/PyrexTypes.py
+2
-0
tests/run/memview_vector.pyx
tests/run/memview_vector.pyx
+14
-0
No files found.
Cython/Compiler/PyrexTypes.py
View file @
e8521a59
...
@@ -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
)
...
...
tests/run/memview_vector.pyx
0 → 100644
View file @
e8521a59
# 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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment