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
3679dca7
Commit
3679dca7
authored
Aug 10, 2018
by
scoder
Committed by
GitHub
Aug 10, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2528 from mattip/numpy-base-access
WIP: MAINT: avoid numpy internals in {sg}et_array_base
parents
3d36766f
b8c4fc58
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
15 deletions
+8
-15
CHANGES.rst
CHANGES.rst
+2
-0
Cython/Includes/numpy/__init__.pxd
Cython/Includes/numpy/__init__.pxd
+6
-15
No files found.
CHANGES.rst
View file @
3679dca7
...
...
@@ -74,6 +74,8 @@ Other changes
package
size
to
about
half
of
its
previous
size
.
This
makes
the
compiler
slightly
slower
,
by
about
5
-
7
%.
*
``
set_array_base
``
now
calls
``
PyArray_SetBaseObject
``.
Also
modified
``
get_array_base
``
to
remove
direct
access
to
NumPy
internals
.
0.28.5
(
2018
-
08
-
03
)
===================
...
...
Cython/Includes/numpy/__init__.pxd
View file @
3679dca7
...
...
@@ -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
object
PyArray_BASE
(
ndarray
)
#wrong refcount semantics?
# dtype PyArray_DESCR(ndarray) wrong refcount semantics
int
PyArray_FLAGS
(
ndarray
)
npy_intp
PyArray_ITEMSIZE
(
ndarray
)
...
...
@@ -719,6 +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
)
# Typedefs that matches the runtime dtype objects in
...
...
@@ -973,23 +974,13 @@ cdef extern from "numpy/ufuncobject.h":
int
_import_umath
()
except
-
1
cdef
inline
void
set_array_base
(
ndarray
arr
,
object
base
):
cdef
PyObject
*
baseptr
if
base
is
None
:
baseptr
=
NULL
else
:
Py_INCREF
(
base
)
# important to do this before decref below!
baseptr
=
<
PyObject
*>
base
Py_XDECREF
(
arr
.
base
)
arr
.
base
=
baseptr
PyArray_SetBaseObject
(
arr
,
base
)
cdef
inline
object
get_array_base
(
ndarray
arr
):
if
arr
.
base
is
NULL
:
return
None
else
:
return
<
object
>
arr
.
base
base
=
PyArray_BASE
(
arr
)
return
<
object
>
base
# Versions of the import_* functions which are more suitable for
# Cython code.
...
...
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