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
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
5c841ce3
Commit
5c841ce3
authored
Jan 12, 2011
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Plain Diff
merge
parents
6ccd5ccc
e5dcfb1f
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
3 deletions
+26
-3
Cython/Compiler/StringEncoding.py
Cython/Compiler/StringEncoding.py
+17
-3
tests/run/strliterals.pyx
tests/run/strliterals.pyx
+9
-0
No files found.
Cython/Compiler/StringEncoding.py
View file @
5c841ce3
...
...
@@ -232,9 +232,23 @@ def escape_byte_string(s):
append
(
c
)
return
join_bytes
(
l
).
decode
(
'ISO-8859-1'
)
def
split_string_literal
(
s
):
def
split_string_literal
(
s
,
limit
=
2000
):
# MSVC can't handle long string literals.
if
len
(
s
)
<
2047
:
if
len
(
s
)
<
limit
:
return
s
else
:
return
'""'
.
join
([
s
[
i
:
i
+
2000
]
for
i
in
range
(
0
,
len
(
s
),
2000
)]).
replace
(
r'\""'
,
'""
\
\
'
)
start
=
0
chunks
=
[]
while
start
<
len
(
s
):
end
=
start
+
limit
if
len
(
s
)
>
end
-
4
and
'
\
\
'
in
s
[
end
-
4
:
end
]:
end
-=
4
-
s
[
end
-
4
:
end
].
find
(
'
\
\
'
)
# just before the backslash
while
s
[
end
-
1
]
==
'
\
\
'
:
end
-=
1
if
end
==
start
:
# must have been a long line of backslashes
end
=
start
+
limit
-
(
limit
%
2
)
-
4
break
chunks
.
append
(
s
[
start
:
end
])
start
=
end
return
'""'
.
join
(
chunks
)
tests/run/strliterals.pyx
View file @
5c841ce3
This diff is collapsed.
Click to expand it.
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