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
3a7fafdb
Commit
3a7fafdb
authored
Feb 19, 2020
by
Matti Picus
Committed by
GitHub
Feb 19, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use properties in numpy.pxd to avoid a dependency on internal details (GH-3365)
parent
6a4a0ada
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
22 additions
and
31 deletions
+22
-31
Cython/Includes/numpy/__init__.pxd
Cython/Includes/numpy/__init__.pxd
+17
-4
docs/examples/tutorial/numpy/convolve2.pyx
docs/examples/tutorial/numpy/convolve2.pyx
+1
-1
runtests.py
runtests.py
+0
-6
tests/run/numpy_bufacc_T155.pyx
tests/run/numpy_bufacc_T155.pyx
+1
-2
tests/run/numpy_cimport.pyx
tests/run/numpy_cimport.pyx
+0
-1
tests/run/numpy_common.pxi
tests/run/numpy_common.pxi
+0
-10
tests/run/numpy_parallel.pyx
tests/run/numpy_parallel.pyx
+1
-2
tests/run/numpy_subarray.pyx
tests/run/numpy_subarray.pyx
+1
-1
tests/run/numpy_test.pyx
tests/run/numpy_test.pyx
+1
-4
No files found.
Cython/Includes/numpy/__init__.pxd
View file @
3a7fafdb
...
...
@@ -244,14 +244,27 @@ cdef extern from "numpy/arrayobject.h":
cdef
:
# Only taking a few of the most commonly used and stable fields.
# One should use PyArray_* macros instead to access the C fields.
char
*
data
int
ndim
"nd"
npy_intp
*
shape
"dimensions"
npy_intp
*
strides
dtype
descr
# deprecated since NumPy 1.7 !
PyObject
*
base
@
property
cdef
int
ndim
(
self
):
return
PyArray_NDIM
(
self
)
@
property
cdef
npy_intp
*
shape
(
self
):
return
PyArray_DIMS
(
self
)
@
property
cdef
npy_intp
*
strides
(
self
):
return
PyArray_STRIDES
(
self
)
@
property
cdef
npy_intp
size
(
self
):
return
PyArray_SIZE
(
ndarray
)
# Note: This syntax (function definition in pxd files) is an
# experimental exception made for __getbuffer__ and __releasebuffer__
# -- the details of this may change.
...
...
docs/examples/tutorial/numpy/convolve2.pyx
View file @
3a7fafdb
# tag: numpy
_old
# tag: numpy
# You can ignore the previous line.
# It's for internal testing of the cython documentation.
...
...
runtests.py
View file @
3a7fafdb
...
...
@@ -136,7 +136,6 @@ def get_distutils_distro(_cache=[]):
EXT_DEP_MODULES
=
{
'tag:numpy'
:
'numpy'
,
'tag:numpy_old'
:
'numpy'
,
'tag:pythran'
:
'pythran'
,
'tag:setuptools'
:
'setuptools.sandbox'
,
'tag:asyncio'
:
'asyncio'
,
...
...
@@ -256,10 +255,6 @@ def update_linetrace_extension(ext):
return ext
def update_old_numpy_extension(ext):
update_numpy_extension(ext, set_api17_macro=False)
def update_numpy_extension(ext, set_api17_macro=True):
import numpy
from numpy.distutils.misc_util import get_info
...
...
@@ -400,7 +395,6 @@ EXCLUDE_EXT = object()
EXT_EXTRAS = {
'tag:numpy' : update_numpy_extension,
'tag:numpy_old' : update_old_numpy_extension,
'tag:openmp': update_openmp_extension,
'tag:cpp11': update_cpp11_extension,
'tag:trace' : update_linetrace_extension,
...
...
tests/run/numpy_bufacc_T155.pyx
View file @
3a7fafdb
# ticket: 155
# tag: numpy
_old
# tag: numpy
"""
>>> myfunc()
...
...
@@ -17,4 +17,3 @@ def myfunc():
A
[
i
,
:]
/=
2
return
A
[
0
,
0
]
include
"numpy_common.pxi"
tests/run/numpy_cimport.pyx
View file @
3a7fafdb
...
...
@@ -6,4 +6,3 @@
True
"""
cimport
numpy
as
np
include
"numpy_common.pxi"
tests/run/numpy_common.pxi
deleted
100644 → 0
View file @
6a4a0ada
# hack to avoid C compiler warnings about unused functions in the NumPy header files
cdef
extern
from
*
:
bint
FALSE
"0"
void
import_array
()
# void import_umath()
if
FALSE
:
import_array
()
# import_umath()
tests/run/numpy_parallel.pyx
View file @
3a7fafdb
# tag: numpy
_old
# tag: numpy
# tag: openmp
cimport
cython
from
cython.parallel
import
prange
cimport
numpy
as
np
include
"numpy_common.pxi"
@
cython
.
boundscheck
(
False
)
...
...
tests/run/numpy_subarray.pyx
View file @
3a7fafdb
# tag: numpy
_old
# tag: numpy
cimport
numpy
as
np
cimport
cython
...
...
tests/run/numpy_test.pyx
View file @
3a7fafdb
# tag: numpy_old
# cannot be named "numpy" in order to not clash with the numpy module!
# tag: numpy
cimport
numpy
as
np
cimport
cython
...
...
@@ -945,5 +944,3 @@ def test_broadcast_comparison(np.ndarray[double, ndim=1] a):
cdef
object
obj
=
a
return
a
==
0
,
obj
==
0
,
a
==
1
,
obj
==
1
include
"numpy_common.pxi"
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