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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gwenaël Samain
cython
Commits
2f575a61
Commit
2f575a61
authored
Oct 11, 2013
by
scoder
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #258 from zyv/fix_array_extend
Multiple fixes to array.extend()
parents
06363710
7f6ac8a3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
3 deletions
+9
-3
Cython/Includes/cpython/array.pxd
Cython/Includes/cpython/array.pxd
+2
-3
tests/run/pyarray.pyx
tests/run/pyarray.pyx
+7
-0
No files found.
Cython/Includes/cpython/array.pxd
View file @
2f575a61
...
...
@@ -154,11 +154,10 @@ cdef inline int extend_buffer(array self, char* stuff, Py_ssize_t n):
return
-
1
memcpy
(
self
.
data
.
as_chars
+
orgsize
*
itemsize
,
stuff
,
n
*
itemsize
)
cdef
inline
int
extend
(
array
self
,
array
other
):
cdef
inline
int
extend
(
array
self
,
array
other
)
except
-
2
:
""" extend array with data from another array; types must match. """
if
self
.
ob_descr
.
typecode
!=
self
.
ob_descr
.
typecode
:
if
self
.
ob_descr
.
typecode
!=
other
.
ob_descr
.
typecode
:
PyErr_BadArgument
()
return
-
1
return
extend_buffer
(
self
,
other
.
data
.
as_chars
,
Py_SIZE
(
other
))
cdef
inline
void
zero
(
array
op
):
...
...
tests/run/pyarray.pyx
View file @
2f575a61
...
...
@@ -147,8 +147,15 @@ def test_extend():
"""
cdef
array
.
array
ca
=
array
.
array
(
'i'
,
[
1
,
2
,
3
])
cdef
array
.
array
cb
=
array
.
array
(
'i'
,
[
4
,
5
])
cdef
array
.
array
cf
=
array
.
array
(
'f'
,
[
1.0
,
2.0
,
3.0
])
array
.
extend
(
ca
,
cb
)
assert
list
(
ca
)
==
[
1
,
2
,
3
,
4
,
5
],
list
(
ca
)
try
:
array
.
extend
(
ca
,
cf
)
except
TypeError
:
pass
else
:
raise
AssertionError
(
'tried to extend with an incompatible array type'
)
def
test_likes
(
a
):
"""
...
...
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