Commit cce7c08a authored by Stefan Behnel's avatar Stefan Behnel

Merge branch '0.27.x'

parents 62f776c8 26ab50ad
...@@ -102,6 +102,6 @@ before_script: ccache -s || true ...@@ -102,6 +102,6 @@ before_script: ccache -s || true
script: script:
- PYTHON_DBG="python$( python -c 'import sys; print("%d.%d" % sys.version_info[:2])' )-dbg" - PYTHON_DBG="python$( python -c 'import sys; print("%d.%d" % sys.version_info[:2])' )-dbg"
- if $PYTHON_DBG -V >&2; then CFLAGS="-O0 -ggdb" $PYTHON_DBG runtests.py -vv Debugger --backends=$BACKEND; fi - if $PYTHON_DBG -V >&2; then CFLAGS="-O0 -ggdb" $PYTHON_DBG runtests.py -vv Debugger --backends=$BACKEND; fi
- if [ false && "$BACKEND" = "cpp" ]; then pip install pythran; fi # disabled: needs Pythran > 0.8.1 - if [ "$BACKEND" = "cpp" ]; then pip install pythran; fi
- CFLAGS="-O2 -ggdb -Wall -Wextra $(python -c 'import sys; print("-fno-strict-aliasing" if sys.version_info[0] == 2 else "")')" python setup.py build_ext -i - CFLAGS="-O2 -ggdb -Wall -Wextra $(python -c 'import sys; print("-fno-strict-aliasing" if sys.version_info[0] == 2 else "")')" python setup.py build_ext -i
- CFLAGS="-O0 -ggdb -Wall -Wextra" python runtests.py -vv -x Debugger --backends=$BACKEND -j7 - CFLAGS="-O0 -ggdb -Wall -Wextra" python runtests.py -vv -x Debugger --backends=$BACKEND -j7
...@@ -4194,7 +4194,7 @@ class BufferIndexNode(_IndexingBaseNode): ...@@ -4194,7 +4194,7 @@ class BufferIndexNode(_IndexingBaseNode):
# case. # case.
code.putln("__Pyx_call_destructor(%s);" % obj) code.putln("__Pyx_call_destructor(%s);" % obj)
code.putln("new (&%s) decltype(%s){%s};" % (obj, obj, self.base.pythran_result())) code.putln("new (&%s) decltype(%s){%s};" % (obj, obj, self.base.pythran_result()))
code.putln("%s(%s) %s= %s;" % ( code.putln("%s%s %s= %s;" % (
obj, obj,
pythran_indexing_code(self.indices), pythran_indexing_code(self.indices),
op, op,
...@@ -4225,7 +4225,7 @@ class BufferIndexNode(_IndexingBaseNode): ...@@ -4225,7 +4225,7 @@ class BufferIndexNode(_IndexingBaseNode):
if is_pythran_expr(self.base.type): if is_pythran_expr(self.base.type):
res = self.result() res = self.result()
code.putln("__Pyx_call_destructor(%s);" % res) code.putln("__Pyx_call_destructor(%s);" % res)
code.putln("new (&%s) decltype(%s){%s[%s]};" % ( code.putln("new (&%s) decltype(%s){%s%s};" % (
res, res,
res, res,
self.base.pythran_result(), self.base.pythran_result(),
......
...@@ -58,8 +58,13 @@ def pythran_unaryop_type(op, type_): ...@@ -58,8 +58,13 @@ def pythran_unaryop_type(op, type_):
op, pythran_type(type_)) op, pythran_type(type_))
def pythran_indexing_type(type_, indices): @cython.ccall
def index_code(idx): def _index_access(index_code, indices):
indexing = ",".join([index_code(idx) for idx in indices])
return ('[%s]' if len(indices) == 1 else '(%s)') % indexing
def _index_type_code(idx):
if idx.is_slice: if idx.is_slice:
if idx.step.is_none: if idx.step.is_none:
func = "contiguous_slice" func = "contiguous_slice"
...@@ -75,12 +80,8 @@ def pythran_indexing_type(type_, indices): ...@@ -75,12 +80,8 @@ def pythran_indexing_type(type_, indices):
return "std::declval<%s>()" % idx.type.pythran_type return "std::declval<%s>()" % idx.type.pythran_type
raise ValueError("unsupported indexing type %s!" % idx.type) raise ValueError("unsupported indexing type %s!" % idx.type)
indexing = ",".join(index_code(idx) for idx in indices)
return type_remove_ref("decltype(std::declval<%s>()[%s])" % (pythran_type(type_), indexing))
def pythran_indexing_code(indices): def _index_code(idx):
def index_code(idx):
if idx.is_slice: if idx.is_slice:
values = idx.start, idx.stop, idx.step values = idx.start, idx.stop, idx.step
if idx.step.is_none: if idx.step.is_none:
...@@ -96,7 +97,16 @@ def pythran_indexing_code(indices): ...@@ -96,7 +97,16 @@ def pythran_indexing_code(indices):
return idx.pythran_result() return idx.pythran_result()
raise ValueError("unsupported indexing type %s" % idx.type) raise ValueError("unsupported indexing type %s" % idx.type)
return ",".join(index_code(idx) for idx in indices)
def pythran_indexing_type(type_, indices):
return type_remove_ref("decltype(std::declval<%s>()%s)" % (
pythran_type(type_),
_index_access(_index_type_code, indices),
))
def pythran_indexing_code(indices):
return _index_access(_index_code, indices)
def pythran_func_type(func, args): def pythran_func_type(func, args):
......
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