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
29d68530
Commit
29d68530
authored
Apr 11, 2012
by
Mark Florisson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't assume a NameNode attribute base in NumpySupport
parent
05739037
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
4 deletions
+13
-4
Cython/Compiler/NumpySupport.py
Cython/Compiler/NumpySupport.py
+1
-1
tests/run/numpy_attributes.pyx
tests/run/numpy_attributes.pyx
+12
-3
No files found.
Cython/Compiler/NumpySupport.py
View file @
29d68530
...
@@ -26,7 +26,7 @@ def numpy_transform_attribute_node(node):
...
@@ -26,7 +26,7 @@ def numpy_transform_attribute_node(node):
return
node
return
node
pos
=
node
.
pos
pos
=
node
.
pos
numpy_pxd_scope
=
node
.
obj
.
entry
.
type
.
scope
.
parent_scope
numpy_pxd_scope
=
node
.
obj
.
type
.
scope
.
parent_scope
def
macro_call_node
(
numpy_macro_name
):
def
macro_call_node
(
numpy_macro_name
):
array_node
=
node
.
obj
array_node
=
node
.
obj
...
...
tests/run/numpy_attributes.pyx
View file @
29d68530
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
import
numpy
as
np
import
numpy
as
np
cimport
numpy
as
np
cimport
numpy
as
np
int64_array
=
np
.
ones
((
3
,
2
),
dtype
=
np
.
int64
)
def
f
():
def
f
():
"""
"""
...
@@ -14,7 +15,7 @@ def f():
...
@@ -14,7 +15,7 @@ def f():
shape[1] 2
shape[1] 2
strides 16 8
strides 16 8
"""
"""
cdef
np
.
ndarray
x
=
np
.
ones
((
3
,
2
),
dtype
=
np
.
int64
)
cdef
np
.
ndarray
x
=
int64_array
cdef
int
i
cdef
int
i
cdef
Py_ssize_t
j
,
k
cdef
Py_ssize_t
j
,
k
cdef
char
*
p
cdef
char
*
p
...
@@ -43,3 +44,11 @@ def f():
...
@@ -43,3 +44,11 @@ def f():
k
=
x
.
strides
[
1
]
k
=
x
.
strides
[
1
]
print
'strides'
,
j
,
k
print
'strides'
,
j
,
k
def
test_non_namenode_attribute_access
(
obj
):
"""
>>> test_non_namenode_attribute_access(int64_array)
data 1
"""
# Try casting, resulting in an AttributeNode with a TypeCastNode as object
# and 'data' as attribute
print
"data"
,
(
<
np
.
int64_t
*>
(
<
np
.
ndarray
>
obj
).
data
)[
0
]
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