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
daa49dd4
Commit
daa49dd4
authored
Aug 09, 2009
by
Kurt Smith
Committed by
Mark Florisson
Sep 30, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
set cython.array entry as used when imported.
parent
ece0f48a
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
9 deletions
+15
-9
Cython/Compiler/Buffer.py
Cython/Compiler/Buffer.py
+2
-0
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+1
-0
tests/run/cythonarray.pyx
tests/run/cythonarray.pyx
+12
-9
No files found.
Cython/Compiler/Buffer.py
View file @
daa49dd4
...
...
@@ -543,6 +543,8 @@ def use_py2_buffer_functions(env):
for
e
in
scope
.
type_entries
:
t
=
e
.
type
if
t
.
is_extension_type
:
if
e
.
name
==
'array'
and
not
e
.
used
:
continue
release
=
get
=
None
for
x
in
t
.
scope
.
pyfunc_entries
:
if
x
.
name
==
u"__getbuffer__"
:
get
=
x
.
func_cname
...
...
Cython/Compiler/Nodes.py
View file @
daa49dd4
...
...
@@ -5808,6 +5808,7 @@ class FromCImportStatNode(StatNode):
if
entry
:
if
kind
and
not
self
.
declaration_matches
(
entry
,
kind
):
entry
.
redeclared
(
pos
)
entry
.
used
=
1
else
:
if
kind
==
'struct'
or
kind
==
'union'
:
entry
=
module_scope
.
declare_struct_or_union
(
name
,
...
...
tests/run/cythonarray.pyx
View file @
daa49dd4
from
cython
cimport
array
# from cython cimport array
# cimport cython.array as array
cimport
cython
as
cy
# array = cython.array
def
contiguity
():
'''
...
...
@@ -10,13 +13,13 @@ def contiguity():
2 3
2
'''
cdef
array
cvarray
=
array
(
shape
=
(
2
,
3
),
itemsize
=
sizeof
(
int
),
format
=
"i"
,
mode
=
'c'
)
cdef
cy
.
array
cvarray
=
cy
.
array
(
shape
=
(
2
,
3
),
itemsize
=
sizeof
(
int
),
format
=
"i"
,
mode
=
'c'
)
assert
cvarray
.
len
==
2
*
3
*
sizeof
(
int
)
assert
cvarray
.
itemsize
==
sizeof
(
int
)
print
cvarray
.
strides
[
0
],
cvarray
.
strides
[
1
]
print
cvarray
.
shape
[
0
],
cvarray
.
shape
[
1
]
print
cvarray
.
ndim
cdef
array
farray
=
array
(
shape
=
(
2
,
3
),
itemsize
=
sizeof
(
int
),
format
=
"i"
,
mode
=
'fortran'
)
cdef
cy
.
array
farray
=
cy
.
array
(
shape
=
(
2
,
3
),
itemsize
=
sizeof
(
int
),
format
=
"i"
,
mode
=
'fortran'
)
assert
farray
.
len
==
2
*
3
*
sizeof
(
int
)
assert
farray
.
itemsize
==
sizeof
(
int
)
print
farray
.
strides
[
0
],
farray
.
strides
[
1
]
...
...
@@ -28,19 +31,19 @@ def acquire():
>>> acquire()
'''
cdef
object
[
int
,
ndim
=
1
,
mode
=
"c"
]
buf1d
=
\
array
(
shape
=
(
10
,),
itemsize
=
sizeof
(
int
),
format
=
'i'
,
mode
=
'c'
)
cy
.
array
(
shape
=
(
10
,),
itemsize
=
sizeof
(
int
),
format
=
'i'
,
mode
=
'c'
)
cdef
object
[
int
,
ndim
=
2
,
mode
=
"c"
]
buf2d
=
\
array
(
shape
=
(
10
,
10
),
itemsize
=
sizeof
(
int
),
format
=
'i'
)
cy
.
array
(
shape
=
(
10
,
10
),
itemsize
=
sizeof
(
int
),
format
=
'i'
)
cdef
object
[
unsigned
long
,
ndim
=
3
,
mode
=
'fortran'
]
buf3d
=
\
array
(
shape
=
(
1
,
2
,
3
),
itemsize
=
sizeof
(
unsigned
long
),
format
=
'L'
,
mode
=
'fortran'
)
cy
.
array
(
shape
=
(
1
,
2
,
3
),
itemsize
=
sizeof
(
unsigned
long
),
format
=
'L'
,
mode
=
'fortran'
)
cdef
object
[
long
double
,
ndim
=
3
,
mode
=
'fortran'
]
bufld
=
\
array
(
shape
=
(
1
,
2
,
3
),
itemsize
=
sizeof
(
long
double
),
format
=
'g'
,
mode
=
'fortran'
)
cy
.
array
(
shape
=
(
1
,
2
,
3
),
itemsize
=
sizeof
(
long
double
),
format
=
'g'
,
mode
=
'fortran'
)
def
full_or_strided
():
'''
>>> full_or_strided()
'''
cdef
object
[
float
,
ndim
=
2
,
mode
=
'full'
]
fullbuf
=
\
array
(
shape
=
(
10
,
10
),
itemsize
=
sizeof
(
float
),
format
=
'f'
,
mode
=
'c'
)
cy
.
array
(
shape
=
(
10
,
10
),
itemsize
=
sizeof
(
float
),
format
=
'f'
,
mode
=
'c'
)
cdef
object
[
long
long
int
,
ndim
=
3
,
mode
=
'strided'
]
stridedbuf
=
\
array
(
shape
=
(
1
,
2
,
3
),
itemsize
=
sizeof
(
long
long
int
),
format
=
'q'
,
mode
=
'fortran'
)
cy
.
array
(
shape
=
(
1
,
2
,
3
),
itemsize
=
sizeof
(
long
long
int
),
format
=
'q'
,
mode
=
'fortran'
)
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