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
cce7c08a
Commit
cce7c08a
authored
Oct 24, 2017
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '0.27.x'
parents
62f776c8
26ab50ad
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
38 deletions
+48
-38
.travis.yml
.travis.yml
+1
-1
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+2
-2
Cython/Compiler/Pythran.py
Cython/Compiler/Pythran.py
+45
-35
No files found.
.travis.yml
View file @
cce7c08a
...
...
@@ -102,6 +102,6 @@ before_script: ccache -s || true
script
:
-
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 [
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="-O0 -ggdb -Wall -Wextra" python runtests.py -vv -x Debugger --backends=$BACKEND -j7
Cython/Compiler/ExprNodes.py
View file @
cce7c08a
...
...
@@ -4194,7 +4194,7 @@ class BufferIndexNode(_IndexingBaseNode):
# case.
code
.
putln
(
"__Pyx_call_destructor(%s);"
%
obj
)
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
,
pythran_indexing_code
(
self
.
indices
),
op
,
...
...
@@ -4225,7 +4225,7 @@ class BufferIndexNode(_IndexingBaseNode):
if
is_pythran_expr
(
self
.
base
.
type
):
res
=
self
.
result
()
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
,
self
.
base
.
pythran_result
(),
...
...
Cython/Compiler/Pythran.py
View file @
cce7c08a
...
...
@@ -58,45 +58,55 @@ def pythran_unaryop_type(op, type_):
op
,
pythran_type
(
type_
))
@
cython
.
ccall
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
.
step
.
is_none
:
func
=
"contiguous_slice"
n
=
2
else
:
func
=
"slice"
n
=
3
return
"pythonic::types::%s(%s)"
%
(
func
,
","
.
join
([
"0"
]
*
n
))
elif
idx
.
type
.
is_int
:
return
"std::declval<%s>()"
%
idx
.
type
.
sign_and_name
()
elif
idx
.
type
.
is_pythran_expr
:
return
"std::declval<%s>()"
%
idx
.
type
.
pythran_type
raise
ValueError
(
"unsupported indexing type %s!"
%
idx
.
type
)
def
_index_code
(
idx
):
if
idx
.
is_slice
:
values
=
idx
.
start
,
idx
.
stop
,
idx
.
step
if
idx
.
step
.
is_none
:
func
=
"contiguous_slice"
values
=
values
[:
2
]
else
:
func
=
"slice"
return
"pythonic::types::%s(%s)"
%
(
func
,
","
.
join
((
v
.
pythran_result
()
for
v
in
values
)))
elif
idx
.
type
.
is_int
:
return
to_pythran
(
idx
)
elif
idx
.
type
.
is_pythran_expr
:
return
idx
.
pythran_result
()
raise
ValueError
(
"unsupported indexing type %s"
%
idx
.
type
)
def
pythran_indexing_type
(
type_
,
indices
):
def
index_code
(
idx
):
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
))
elif
idx
.
type
.
is_int
:
return
"std::declval<%s>()"
%
idx
.
type
.
sign_and_name
()
elif
idx
.
type
.
is_pythran_expr
:
return
"std::declval<%s>()"
%
idx
.
type
.
pythran_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
))
return
type_remove_ref
(
"decltype(std::declval<%s>()%s)"
%
(
pythran_type
(
type_
),
_index_access
(
_index_type_code
,
indices
),
))
def
pythran_indexing_code
(
indices
):
def
index_code
(
idx
):
if
idx
.
is_slice
:
values
=
idx
.
start
,
idx
.
stop
,
idx
.
step
if
idx
.
step
.
is_none
:
func
=
"contiguous_slice"
values
=
values
[:
2
]
else
:
func
=
"slice"
return
"pythonic::types::%s(%s)"
%
(
func
,
","
.
join
((
v
.
pythran_result
()
for
v
in
values
)))
elif
idx
.
type
.
is_int
:
return
to_pythran
(
idx
)
elif
idx
.
type
.
is_pythran_expr
:
return
idx
.
pythran_result
()
raise
ValueError
(
"unsupported indexing type %s"
%
idx
.
type
)
return
","
.
join
(
index_code
(
idx
)
for
idx
in
indices
)
return
_index_access
(
_index_code
,
indices
)
def
pythran_func_type
(
func
,
args
):
...
...
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