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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cython
Commits
97d63102
Commit
97d63102
authored
Mar 21, 2020
by
serge-sans-paille
Committed by
GitHub
Mar 21, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adapt to Pythran update: __builtin__ -> builtins (GH-3308)
parent
92625467
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
4 deletions
+13
-4
Cython/Compiler/Pythran.py
Cython/Compiler/Pythran.py
+13
-4
No files found.
Cython/Compiler/Pythran.py
View file @
97d63102
...
...
@@ -9,9 +9,16 @@ import cython
try
:
import
pythran
pythran_is_pre_0_9
=
tuple
(
map
(
int
,
pythran
.
__version__
.
split
(
'.'
)[
0
:
2
]))
<
(
0
,
9
)
pythran_is_pre_0_9_6
=
tuple
(
map
(
int
,
pythran
.
__version__
.
split
(
'.'
)[
0
:
3
]))
<
(
0
,
9
,
6
)
except
ImportError
:
pythran
=
None
pythran_is_pre_0_9
=
True
pythran_is_pre_0_9_6
=
True
if
pythran_is_pre_0_9_6
:
pythran_builtins
=
'__builtin__'
else
:
pythran_builtins
=
'builtins'
# Pythran/Numpy specific operations
...
...
@@ -47,7 +54,7 @@ def pythran_type(Ty, ptype="ndarray"):
if
Ty
.
is_pythran_expr
:
return
Ty
.
pythran_type
#if Ty.is_none:
# return "decltype(pythonic::
__builtin__
::None)"
# return "decltype(pythonic::
builtins
::None)"
if
Ty
.
is_numeric
:
return
Ty
.
sign_and_name
()
raise
ValueError
(
"unsupported pythran type %s (%s)"
%
(
Ty
,
type
(
Ty
)))
...
...
@@ -82,7 +89,9 @@ def _index_type_code(index_with_type):
idx
,
index_type
=
index_with_type
if
idx
.
is_slice
:
n
=
2
+
int
(
not
idx
.
step
.
is_none
)
return
"pythonic::__builtin__::functor::slice{}(%s)"
%
(
","
.
join
([
"0"
]
*
n
))
return
"pythonic::%s::functor::slice{}(%s)"
%
(
pythran_builtins
,
","
.
join
([
"0"
]
*
n
))
elif
index_type
.
is_int
:
return
"std::declval<%s>()"
%
index_type
.
sign_and_name
()
elif
index_type
.
is_pythran_expr
:
...
...
@@ -154,7 +163,7 @@ def to_pythran(op, ptype=None):
if
is_type
(
op_type
,
[
"is_pythran_expr"
,
"is_numeric"
,
"is_float"
,
"is_complex"
]):
return
op
.
result
()
if
op
.
is_none
:
return
"pythonic::
__builtin__::None"
return
"pythonic::
%s::None"
%
pythran_builtins
if
ptype
is
None
:
ptype
=
pythran_type
(
op_type
)
...
...
@@ -207,7 +216,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
(
"pythonic/
%s/slice.hpp"
%
pythran_builtins
)
env
.
add_include_file
(
"<new>"
)
# for placement new
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