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
cc43e481
Commit
cc43e481
authored
Sep 17, 2011
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow pure cython directives in inline/compiled code.
parent
f81c0b0b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
1 deletion
+6
-1
Cython/Build/Inline.py
Cython/Build/Inline.py
+6
-1
No files found.
Cython/Build/Inline.py
View file @
cc43e481
...
...
@@ -16,6 +16,7 @@ from Cython.Compiler.ParseTreeTransforms import CythonTransform, SkipDeclaration
from
Cython.Compiler.TreeFragment
import
parse_from_strings
from
Cython.Build.Dependencies
import
strip_string_literals
,
cythonize
from
Cython.Compiler
import
Pipeline
import
cython
as
cython_module
# A utility function to convert user-supplied ASCII strings to unicode.
if
sys
.
version_info
[
0
]
<
3
:
...
...
@@ -125,6 +126,11 @@ def cython_inline(code,
if
not
quiet
:
# Parsing from strings not fully supported (e.g. cimports).
print
(
"Could not parse code as a string (to extract unbound symbols)."
)
cimports
=
[]
for
name
,
arg
in
kwds
.
items
():
if
arg
is
cython_module
:
cimports
.
append
(
'
\
n
cimport cython as %s'
%
name
)
del
kwds
[
name
]
arg_names
=
kwds
.
keys
()
arg_names
.
sort
()
arg_sigs
=
tuple
([(
get_type
(
kwds
[
arg
],
ctx
),
arg
)
for
arg
in
arg_names
])
...
...
@@ -142,7 +148,6 @@ def cython_inline(code,
except
ImportError
:
cflags
=
[]
c_include_dirs
=
[]
cimports
=
[]
qualified
=
re
.
compile
(
r'([.\
w]+)[.]
')
for type, _ in arg_sigs:
m = qualified.match(type)
...
...
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