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
6104ba2a
Commit
6104ba2a
authored
Feb 25, 2018
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix some variable usages in Pythran buffer type checking code.
parent
1b0069bb
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
6 deletions
+7
-6
Cython/Compiler/FusedNode.py
Cython/Compiler/FusedNode.py
+7
-6
No files found.
Cython/Compiler/FusedNode.py
View file @
6104ba2a
...
@@ -421,10 +421,11 @@ class FusedCFuncDefNode(StatListNode):
...
@@ -421,10 +421,11 @@ class FusedCFuncDefNode(StatListNode):
# The first thing to find a match in this loop breaks out of the loop
# The first thing to find a match in this loop breaks out of the loop
pyx_code
.
put_chunk
(
pyx_code
.
put_chunk
(
u"""
u"""
"""
+
(
u"arg_is_pythran_compatible = False"
if
pythran_types
else
u""
)
+
u"""
if ndarray is not None:
if ndarray is not None:
if isinstance(arg, ndarray):
if isinstance(arg, ndarray):
dtype = arg.dtype
dtype = arg.dtype
"""
+
(
"arg_is_pythran_compatible = True"
if
pythran_types
else
""
)
+
"""
"""
+
(
u"arg_is_pythran_compatible = True"
if
pythran_types
else
u""
)
+
u
"""
elif __pyx_memoryview_check(arg):
elif __pyx_memoryview_check(arg):
arg_base = arg.base
arg_base = arg.base
if isinstance(arg_base, ndarray):
if isinstance(arg_base, ndarray):
...
@@ -444,7 +445,7 @@ class FusedCFuncDefNode(StatListNode):
...
@@ -444,7 +445,7 @@ class FusedCFuncDefNode(StatListNode):
if
pythran_types
:
if
pythran_types
:
pyx_code
.
put_chunk
(
pyx_code
.
put_chunk
(
u"""
u"""
#
We only support
the endianness of the current compiler
#
Pythran only supports
the endianness of the current compiler
byteorder = dtype.byteorder
byteorder = dtype.byteorder
if byteorder == "<" and not __Pyx_Is_Little_Endian():
if byteorder == "<" and not __Pyx_Is_Little_Endian():
arg_is_pythran_compatible = False
arg_is_pythran_compatible = False
...
@@ -455,12 +456,12 @@ class FusedCFuncDefNode(StatListNode):
...
@@ -455,12 +456,12 @@ class FusedCFuncDefNode(StatListNode):
shape = arg.shape
shape = arg.shape
strides = arg.strides
strides = arg.strides
for i in range(arg.ndim):
for i in range(arg.ndim):
if
strides[i]
!= cur_stride:
if
(<Py_ssize_t>strides[i])
!= cur_stride:
arg_is_pythran_compatible = False
arg_is_pythran_compatible = False
break
break
cur_stride *= shape[i]
cur_stride *=
<Py_ssize_t>
shape[i]
else:
else:
arg_is_pythran_compatible = not (arg.flags.f_contiguous and
arg.ndim
> 1)
arg_is_pythran_compatible = not (arg.flags.f_contiguous and
(<Py_ssize_t>arg.ndim)
> 1)
"""
)
"""
)
pyx_code
.
named_insertion_point
(
"numpy_dtype_checks"
)
pyx_code
.
named_insertion_point
(
"numpy_dtype_checks"
)
self
.
_buffer_check_numpy_dtype
(
pyx_code
,
buffer_types
,
pythran_types
)
self
.
_buffer_check_numpy_dtype
(
pyx_code
,
buffer_types
,
pythran_types
)
...
@@ -497,7 +498,7 @@ class FusedCFuncDefNode(StatListNode):
...
@@ -497,7 +498,7 @@ class FusedCFuncDefNode(StatListNode):
if
pythran_types
:
if
pythran_types
:
pyx_code
.
local_variable_declarations
.
put_chunk
(
u"""
pyx_code
.
local_variable_declarations
.
put_chunk
(
u"""
cdef bint arg_is_pythran_compatible
cdef bint arg_is_pythran_compatible
arg_is_pythran_compatible = Fals
e
cdef Py_ssize_t cur_strid
e
"""
)
"""
)
pyx_code
.
imports
.
put_chunk
(
pyx_code
.
imports
.
put_chunk
(
...
...
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