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
316f84f2
Commit
316f84f2
authored
Aug 10, 2018
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up interface of PyArray_SetBaseObject() and get_array_base() in numpy declarations.
See #2528.
parent
3679dca7
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
+5
-3
Cython/Includes/numpy/__init__.pxd
Cython/Includes/numpy/__init__.pxd
+5
-3
No files found.
Cython/Includes/numpy/__init__.pxd
View file @
316f84f2
...
...
@@ -395,7 +395,7 @@ cdef extern from "numpy/arrayobject.h":
npy_intp
PyArray_DIM
(
ndarray
,
size_t
)
npy_intp
PyArray_STRIDE
(
ndarray
,
size_t
)
object
PyArray_BASE
(
ndarray
)
#wrong refcount semantics?
PyObject
*
PyArray_BASE
(
ndarray
)
# returns borrowed reference!
# dtype PyArray_DESCR(ndarray) wrong refcount semantics
int
PyArray_FLAGS
(
ndarray
)
npy_intp
PyArray_ITEMSIZE
(
ndarray
)
...
...
@@ -719,7 +719,7 @@ cdef extern from "numpy/arrayobject.h":
object
PyArray_CheckAxis
(
ndarray
,
int
*
,
int
)
npy_intp
PyArray_OverflowMultiplyList
(
npy_intp
*
,
int
)
int
PyArray_CompareString
(
char
*
,
char
*
,
size_t
)
int
PyArray_SetBaseObject
(
ndarray
,
object
)
int
PyArray_SetBaseObject
(
ndarray
,
base
)
# NOTE: steals a reference to base! Use "set_array_base()" instead.
# Typedefs that matches the runtime dtype objects in
...
...
@@ -975,11 +975,13 @@ cdef extern from "numpy/ufuncobject.h":
int
_import_umath
()
except
-
1
cdef
inline
void
set_array_base
(
ndarray
arr
,
object
base
):
Py_INCREF
(
base
)
# important to do this before
decref
below!
Py_INCREF
(
base
)
# important to do this before
stealing the reference
below!
PyArray_SetBaseObject
(
arr
,
base
)
cdef
inline
object
get_array_base
(
ndarray
arr
):
base
=
PyArray_BASE
(
arr
)
if
base
is
NULL
:
return
None
return
<
object
>
base
# Versions of the import_* functions which are more suitable for
...
...
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