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
d8be3ad8
Commit
d8be3ad8
authored
Jul 23, 2015
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix exception in cython.inline() when text block to dedent starts without initial indentation
parent
762b3151
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
10 deletions
+12
-10
Cython/Build/Inline.py
Cython/Build/Inline.py
+12
-10
No files found.
Cython/Build/Inline.py
View file @
d8be3ad8
...
@@ -221,27 +221,29 @@ def __invoke(%(params)s):
...
@@ -221,27 +221,29 @@ def __invoke(%(params)s):
# overridden with actual value upon the first cython_inline invocation
# overridden with actual value upon the first cython_inline invocation
cython_inline.so_ext = None
cython_inline.so_ext = None
non_space = re.compile('
[
^
]
')
_find_non_space = re.compile('
[
^
]
').search
def strip_common_indent(code):
def strip_common_indent(code):
min_indent = None
min_indent = None
lines = code.split
('
\
n
'
)
lines = code.split
lines(
)
for line in lines:
for line in lines:
match =
non_space.search
(line)
match =
_find_non_space
(line)
if not match:
if not match:
continue # blank
continue # blank
indent = match.start()
indent = match.start()
if line[indent] == '
#':
if line[indent] == '
#':
continue
# comment
continue
# comment
el
if
min_indent
is
None
or
min_indent
>
indent
:
if
min_indent
is
None
or
min_indent
>
indent
:
min_indent
=
indent
min_indent
=
indent
for
ix
,
line
in
enumerate
(
lines
):
for
ix
,
line
in
enumerate
(
lines
):
match
=
non_space
.
search
(
line
)
match
=
_find_non_space
(
line
)
if
not
match
or
line
[
indent
]
==
'#'
:
if
not
match
or
not
line
or
line
[
indent
:
indent
+
1
]
==
'#'
:
continue
continue
else
:
lines
[
ix
]
=
line
[
min_indent
:]
lines
[
ix
]
=
line
[
min_indent
:]
return
'
\
n
'
.
join
(
lines
)
return
'
\
n
'
.
join
(
lines
)
module_statement
=
re
.
compile
(
r'^((cdef +(extern|class))|cimport|(from .+ cimport)|(from .+ import +[*]))'
)
module_statement
=
re
.
compile
(
r'^((cdef +(extern|class))|cimport|(from .+ cimport)|(from .+ import +[*]))'
)
def
extract_func_code
(
code
):
def
extract_func_code
(
code
):
module
=
[]
module
=
[]
...
...
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