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
a275799a
Commit
a275799a
authored
Jun 11, 2019
by
serge-sans-paille
Committed by
Stefan Behnel
Jun 11, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify slice handling in Pythran (GH-2989)
And make it more flexible in terms of API change.
parent
5bf168ac
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
8 deletions
+3
-8
Cython/Compiler/Pythran.py
Cython/Compiler/Pythran.py
+3
-8
No files found.
Cython/Compiler/Pythran.py
View file @
a275799a
...
@@ -81,14 +81,8 @@ def _index_access(index_code, indices):
...
@@ -81,14 +81,8 @@ def _index_access(index_code, indices):
def
_index_type_code
(
index_with_type
):
def
_index_type_code
(
index_with_type
):
idx
,
index_type
=
index_with_type
idx
,
index_type
=
index_with_type
if
idx
.
is_slice
:
if
idx
.
is_slice
:
if
idx
.
step
.
is_none
:
n
=
2
+
int
(
not
idx
.
step
.
is_none
)
func
=
"contiguous_slice"
return
"pythonic::__builtin__::functor::slice{}(%s)"
%
(
","
.
join
([
"0"
]
*
n
))
n
=
2
else
:
func
=
"slice"
n
=
3
return
"pythonic::types::%s(%s)"
%
(
func
,
","
.
join
([
"0"
]
*
n
))
elif
index_type
.
is_int
:
elif
index_type
.
is_int
:
return
"std::declval<%s>()"
%
index_type
.
sign_and_name
()
return
"std::declval<%s>()"
%
index_type
.
sign_and_name
()
elif
index_type
.
is_pythran_expr
:
elif
index_type
.
is_pythran_expr
:
...
@@ -213,6 +207,7 @@ def include_pythran_generic(env):
...
@@ -213,6 +207,7 @@ def include_pythran_generic(env):
env
.
add_include_file
(
"pythonic/types/bool.hpp"
)
env
.
add_include_file
(
"pythonic/types/bool.hpp"
)
env
.
add_include_file
(
"pythonic/types/ndarray.hpp"
)
env
.
add_include_file
(
"pythonic/types/ndarray.hpp"
)
env
.
add_include_file
(
"pythonic/numpy/power.hpp"
)
env
.
add_include_file
(
"pythonic/numpy/power.hpp"
)
env
.
add_include_file
(
"pythonic/__builtin__/slice.hpp"
)
env
.
add_include_file
(
"<new>"
)
# for placement new
env
.
add_include_file
(
"<new>"
)
# for placement new
for
i
in
(
8
,
16
,
32
,
64
):
for
i
in
(
8
,
16
,
32
,
64
):
...
...
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