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
Xavier Thompson
cython
Commits
3c82deac
Commit
3c82deac
authored
Mar 05, 2015
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reduce generated code size a bit by discarding end-of-line whitespace from multi-line C macros
parent
2fc964bc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
2 deletions
+5
-2
Cython/Compiler/Code.py
Cython/Compiler/Code.py
+5
-2
No files found.
Cython/Compiler/Code.py
View file @
3c82deac
...
...
@@ -14,9 +14,10 @@ cython.declare(os=object, re=object, operator=object,
import
os
import
re
import
sys
from
string
import
Template
import
operator
import
textwrap
from
string
import
Template
from
functools
import
partial
try
:
import
hashlib
...
...
@@ -152,9 +153,11 @@ class UtilityCodeBase(object):
if ext in ('.pyx', '.py', '.pxd', '.pxi'):
comment = '#'
replace_comments = re.compile(r'^
\
s*#.*
'
).sub
rstrip = unicode.rstrip
else:
comment = '/'
replace_comments = re.compile(r'^
\
s*//.*|/
\
*[^*]*
\
*/
'
).sub
rstrip = partial(re.compile(r'
\
s*(
\
\
?)$
'
).sub, r'
\
1
')
match_special = re.compile(
(r'^%(C)s{5,30}
\
s*(?P<
n
ame>(?:
\
w|
\
.)+)
\
s*%(C)s{
5
,30}|'
r'^%(C)s+@(?P<tag>
\
w+)
\
s*:
\
s*(?P<
v
alue>(?:
\
w|[.:])+)
'
...
...
@@ -194,7 +197,7 @@ class UtilityCodeBase(object):
tags.setdefault(m.group('tag'), set()).add(m.group('value'))
lines.append('') # keep line number correct
else:
lines.append(r
eplace_comments('', line).rstrip(
))
lines.append(r
strip(replace_comments('', line)
))
if utility is None:
raise ValueError("
Empty
utility
code
file
")
...
...
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