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
80638c1a
Commit
80638c1a
authored
Apr 23, 2014
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Let cython.inline return all defined variables by default.
parent
87049841
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
5 deletions
+16
-5
Cython/Build/Inline.py
Cython/Build/Inline.py
+8
-4
Cython/Build/Tests/TestInline.py
Cython/Build/Tests/TestInline.py
+8
-1
No files found.
Cython/Build/Inline.py
View file @
80638c1a
...
@@ -185,7 +185,11 @@ def cython_inline(code,
...
@@ -185,7 +185,11 @@ def cython_inline(code,
%(cimports)s
%(cimports)s
def __invoke(%(params)s):
def __invoke(%(params)s):
%(func_body)s
%(func_body)s
""" % {'
cimports
': '
\
n
'.join(cimports), '
module_body
': module_body, '
params
': params, '
func_body
': func_body }
return locals()
""" % {'
cimports
': '
\
n
'.join(cimports),
'
module_body
': module_body,
'
params
': params,
'
func_body
': func_body }
for key, value in literals.items():
for key, value in literals.items():
module_code = module_code.replace(key, value)
module_code = module_code.replace(key, value)
pyx_file = os.path.join(lib_dir, module_name + '
.
pyx
')
pyx_file = os.path.join(lib_dir, module_name + '
.
pyx
')
...
...
Cython/Build/Tests/TestInline.py
View file @
80638c1a
...
@@ -40,6 +40,13 @@ class TestInline(CythonTest):
...
@@ -40,6 +40,13 @@ class TestInline(CythonTest):
def
test_globals
(
self
):
def
test_globals
(
self
):
self
.
assertEquals
(
inline
(
"return global_value + 1"
,
**
self
.
test_kwds
),
global_value
+
1
)
self
.
assertEquals
(
inline
(
"return global_value + 1"
,
**
self
.
test_kwds
),
global_value
+
1
)
def
test_no_return
(
self
):
self
.
assertEquals
(
inline
(
"""
a = 1
cdef double b = 2
cdef c = []
"""
),
dict
(
a
=
1
,
b
=
2.0
,
c
=
[]))
def
test_pure
(
self
):
def
test_pure
(
self
):
import
cython
as
cy
import
cython
as
cy
b
=
inline
(
"""
b
=
inline
(
"""
...
...
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