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
Kirill Smelkov
cython
Commits
e426bbd4
Commit
e426bbd4
authored
May 15, 2020
by
jbrockmendel
Committed by
Stefan Behnel
May 16, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix PyArray_SearchSorted signature (GH-3606)
parent
5f9800ab
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
5 deletions
+19
-5
Cython/Includes/numpy/__init__.pxd
Cython/Includes/numpy/__init__.pxd
+1
-2
tests/run/numpy_test.pyx
tests/run/numpy_test.pyx
+18
-3
No files found.
Cython/Includes/numpy/__init__.pxd
View file @
e426bbd4
...
...
@@ -341,7 +341,6 @@ cdef extern from "numpy/arrayobject.h":
PyObject_Free
(
info
.
strides
)
# info.shape was stored after info.strides in the same block
ctypedef
unsigned
char
npy_bool
ctypedef
signed
char
npy_byte
...
...
@@ -686,7 +685,7 @@ cdef extern from "numpy/arrayobject.h":
object
PyArray_Choose
(
ndarray
,
object
,
ndarray
,
NPY_CLIPMODE
)
int
PyArray_Sort
(
ndarray
,
int
,
NPY_SORTKIND
)
object
PyArray_ArgSort
(
ndarray
,
int
,
NPY_SORTKIND
)
object
PyArray_SearchSorted
(
ndarray
,
object
,
NPY_SEARCHSIDE
)
object
PyArray_SearchSorted
(
ndarray
,
object
,
NPY_SEARCHSIDE
,
PyObject
*
)
object
PyArray_ArgMax
(
ndarray
,
int
,
ndarray
)
object
PyArray_ArgMin
(
ndarray
,
int
,
ndarray
)
object
PyArray_Reshape
(
ndarray
,
object
)
...
...
tests/run/numpy_test.pyx
View file @
e426bbd4
...
...
@@ -7,6 +7,9 @@ cimport cython
import
re
import
sys
# initialise NumPy C-API
np
.
import_array
()
def
little_endian
():
cdef
int
endian_detector
=
1
...
...
@@ -182,7 +185,7 @@ try:
('a', np.dtype('i,i')),
\
('b', np.dtype('i,i'))
\
])))) # doctest: +NORMALIZE_WHITESPACE
array([((0, 0), (0, 0)), ((1, 2), (1, 4)), ((1, 2), (1, 4))],
array([((0, 0), (0, 0)), ((1, 2), (1, 4)), ((1, 2), (1, 4))],
dtype=[('a', [('f0', '!i4'), ('f1', '!i4')]), ('b', [('f0', '!i4'), ('f1', '!i4')])])
>>> print(test_nested_dtypes(np.zeros((3,), dtype=np.dtype([
\
...
...
@@ -235,7 +238,7 @@ try:
8,16
>>> test_point_record() # doctest: +NORMALIZE_WHITESPACE
array([(0., 0.), (1., -1.), (2., -2.)],
array([(0., 0.), (1., -1.), (2., -2.)],
dtype=[('x', '!f8'), ('y', '!f8')])
"""
...
...
@@ -947,4 +950,16 @@ def test_broadcast_comparison(np.ndarray[double, ndim=1] a):
return
a
==
0
,
obj
==
0
,
a
==
1
,
obj
==
1
include
"numpy_common.pxi"
@
testcase
def
test_c_api_searchsorted
(
np
.
ndarray
arr
,
other
):
"""
>>> arr = np.random.randn(10)
>>> other = np.random.randn(5)
>>> result, expected = test_c_api_searchsorted(arr, other)
>>> (result == expected).all()
True
"""
result
=
np
.
PyArray_SearchSorted
(
arr
,
other
,
np
.
NPY_SEARCHRIGHT
,
NULL
)
expected
=
arr
.
searchsorted
(
other
,
side
=
"right"
)
return
result
,
expected
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