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
Boxiang Sun
cython
Commits
3070370a
Commit
3070370a
authored
Sep 07, 2018
by
scoder
Committed by
GitHub
Sep 07, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2595 from alubbock/inline_directives
cython_inline compiler directives support
parents
ab544dfa
be211dd2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
3 deletions
+17
-3
Cython/Build/Inline.py
Cython/Build/Inline.py
+9
-3
Cython/Build/Tests/TestInline.py
Cython/Build/Tests/TestInline.py
+8
-0
No files found.
Cython/Build/Inline.py
View file @
3070370a
...
@@ -136,8 +136,10 @@ def _populate_unbound(kwds, unbound_symbols, locals=None, globals=None):
...
@@ -136,8 +136,10 @@ def _populate_unbound(kwds, unbound_symbols, locals=None, globals=None):
else
:
else
:
print
(
"Couldn't find %r"
%
symbol
)
print
(
"Couldn't find %r"
%
symbol
)
def
cython_inline
(
code
,
get_type
=
unsafe_type
,
lib_dir
=
os
.
path
.
join
(
get_cython_cache_dir
(),
'inline'
),
def
cython_inline
(
code
,
get_type
=
unsafe_type
,
cython_include_dirs
=
None
,
force
=
False
,
quiet
=
False
,
locals
=
None
,
globals
=
None
,
**
kwds
):
lib_dir
=
os
.
path
.
join
(
get_cython_cache_dir
(),
'inline'
),
cython_include_dirs
=
None
,
cython_compiler_directives
=
None
,
force
=
False
,
quiet
=
False
,
locals
=
None
,
globals
=
None
,
**
kwds
):
if
get_type
is
None
:
if
get_type
is
None
:
get_type
=
lambda
x
:
'object'
get_type
=
lambda
x
:
'object'
...
@@ -233,7 +235,11 @@ def __invoke(%(params)s):
...
@@ -233,7 +235,11 @@ def __invoke(%(params)s):
extra_compile_args = cflags)
extra_compile_args = cflags)
if build_extension is None:
if build_extension is None:
build_extension = _get_build_extension()
build_extension = _get_build_extension()
build_extension.extensions = cythonize([extension], include_path=cython_include_dirs or ['
.
'], quiet=quiet)
build_extension.extensions = cythonize(
[extension],
include_path=cython_include_dirs or ['
.
'],
compiler_directives=cython_compiler_directives or {},
quiet=quiet)
build_extension.build_temp = os.path.dirname(pyx_file)
build_extension.build_temp = os.path.dirname(pyx_file)
build_extension.build_lib = lib_dir
build_extension.build_lib = lib_dir
build_extension.run()
build_extension.run()
...
...
Cython/Build/Tests/TestInline.py
View file @
3070370a
...
@@ -60,6 +60,14 @@ class TestInline(CythonTest):
...
@@ -60,6 +60,14 @@ class TestInline(CythonTest):
"""
,
a
=
3
,
**
self
.
test_kwds
)
"""
,
a
=
3
,
**
self
.
test_kwds
)
self
.
assertEquals
(
type
(
b
),
float
)
self
.
assertEquals
(
type
(
b
),
float
)
def
test_compiler_directives
(
self
):
self
.
assertEqual
(
inline
(
'return sum(x)'
,
x
=
[
1
,
2
,
3
],
cython_compiler_directives
=
{
'boundscheck'
:
False
}),
6
)
if
has_numpy
:
if
has_numpy
:
def
test_numpy
(
self
):
def
test_numpy
(
self
):
...
...
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