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
Boxiang Sun
cython
Commits
0101be0f
Commit
0101be0f
authored
Oct 17, 2016
by
Robert Bradshaw
Committed by
GitHub
Oct 17, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1487 from jdemeyer/numpy_import_array
Implement numpy's import_array and friends in Cython
parents
24a174d2
d7b5368b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
2 deletions
+23
-2
Cython/Includes/numpy/__init__.pxd
Cython/Includes/numpy/__init__.pxd
+23
-2
No files found.
Cython/Includes/numpy/__init__.pxd
View file @
0101be0f
...
@@ -369,7 +369,7 @@ cdef extern from "numpy/arrayobject.h":
...
@@ -369,7 +369,7 @@ cdef extern from "numpy/arrayobject.h":
npy_intp
*
ptr
npy_intp
*
ptr
int
len
int
len
void
import_array
()
int
_import_array
()
except
-
1
#
#
# Macros from ndarrayobject.h
# Macros from ndarrayobject.h
...
@@ -960,7 +960,7 @@ cdef extern from "numpy/ufuncobject.h":
...
@@ -960,7 +960,7 @@ cdef extern from "numpy/ufuncobject.h":
(
PyUFuncGenericFunction
*
,
void
**
,
char
*
,
int
,
int
,
int
,
(
PyUFuncGenericFunction
*
,
void
**
,
char
*
,
int
,
int
,
int
,
int
,
char
*
,
char
*
,
int
,
char
*
)
int
,
char
*
,
char
*
,
int
,
char
*
)
void
import_ufunc
()
int
_import_umath
()
except
-
1
cdef
inline
void
set_array_base
(
ndarray
arr
,
object
base
):
cdef
inline
void
set_array_base
(
ndarray
arr
,
object
base
):
...
@@ -978,3 +978,24 @@ cdef inline object get_array_base(ndarray arr):
...
@@ -978,3 +978,24 @@ cdef inline object get_array_base(ndarray arr):
return
None
return
None
else
:
else
:
return
<
object
>
arr
.
base
return
<
object
>
arr
.
base
# Versions of the import_* functions which are more suitable for
# Cython code.
cdef
inline
int
import_array
()
except
-
1
:
try
:
_import_array
()
except
Exception
:
raise
ImportError
(
"numpy.core.multiarray failed to import"
)
cdef
inline
int
import_umath
()
except
-
1
:
try
:
_import_umath
()
except
Exception
:
raise
ImportError
(
"numpy.core.umath failed to import"
)
cdef
inline
int
import_ufunc
()
except
-
1
:
try
:
_import_umath
()
except
Exception
:
raise
ImportError
(
"numpy.core.umath failed to import"
)
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