Commit bf5ec12b authored by serge-sans-paille's avatar serge-sans-paille Committed by Stefan Behnel

Simplify slice handling in Pythran (GH-2989)

And make it more flexible in terms of API change.
parent 79005031
......@@ -81,14 +81,8 @@ def _index_access(index_code, indices):
def _index_type_code(index_with_type):
idx, index_type = index_with_type
if idx.is_slice:
if idx.step.is_none:
func = "contiguous_slice"
n = 2
else:
func = "slice"
n = 3
return "pythonic::types::%s(%s)" % (
func, ",".join(["0"]*n))
n = 2 + int(not idx.step.is_none)
return "pythonic::__builtin__::functor::slice{}(%s)" % (",".join(["0"]*n))
elif index_type.is_int:
return "std::declval<%s>()" % index_type.sign_and_name()
elif index_type.is_pythran_expr:
......@@ -213,6 +207,7 @@ def include_pythran_generic(env):
env.add_include_file("pythonic/types/bool.hpp")
env.add_include_file("pythonic/types/ndarray.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
for i in (8, 16, 32, 64):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment