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
fabe1ee5
Commit
fabe1ee5
authored
Feb 12, 2010
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't split long literals at backslash.
parent
adeeaec3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
5 deletions
+5
-5
Cython/Compiler/Code.py
Cython/Compiler/Code.py
+1
-1
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+2
-2
Cython/Compiler/StringEncoding.py
Cython/Compiler/StringEncoding.py
+2
-2
No files found.
Cython/Compiler/Code.py
View file @
fabe1ee5
...
@@ -669,7 +669,7 @@ class GlobalState(object):
...
@@ -669,7 +669,7 @@ class GlobalState(object):
decls_writer = self.parts['decls']
decls_writer = self.parts['decls']
for _, cname, c in c_consts:
for _, cname, c in c_consts:
decls_writer.putln('static char %s[] = "
%
s
";' % (
decls_writer.putln('static char %s[] = "
%
s
";' % (
cname, StringEncoding.split_
docstring
(c.escaped_value)))
cname, StringEncoding.split_
string_literal
(c.escaped_value)))
if c.py_strings is not None:
if c.py_strings is not None:
for py_string in c.py_strings.itervalues():
for py_string in c.py_strings.itervalues():
py_strings.append((c.cname, len(py_string.cname), py_string))
py_strings.append((c.cname, len(py_string.cname), py_string))
...
...
Cython/Compiler/Nodes.py
View file @
fabe1ee5
...
@@ -22,7 +22,7 @@ from Symtab import ModuleScope, LocalScope, GeneratorLocalScope, \
...
@@ -22,7 +22,7 @@ from Symtab import ModuleScope, LocalScope, GeneratorLocalScope, \
StructOrUnionScope
,
PyClassScope
,
CClassScope
,
CppClassScope
StructOrUnionScope
,
PyClassScope
,
CClassScope
,
CppClassScope
from
Cython.Utils
import
open_new_file
,
replace_suffix
from
Cython.Utils
import
open_new_file
,
replace_suffix
from
Code
import
UtilityCode
from
Code
import
UtilityCode
from
StringEncoding
import
EncodedString
,
escape_byte_string
,
split_
docstring
from
StringEncoding
import
EncodedString
,
escape_byte_string
,
split_
string_literal
import
Options
import
Options
import
ControlFlow
import
ControlFlow
import
DebugFlags
import
DebugFlags
...
@@ -2052,7 +2052,7 @@ class DefNode(FuncDefNode):
...
@@ -2052,7 +2052,7 @@ class DefNode(FuncDefNode):
code
.
putln
(
code
.
putln
(
'static char %s[] = "%s";'
%
(
'static char %s[] = "%s";'
%
(
self
.
entry
.
doc_cname
,
self
.
entry
.
doc_cname
,
split_
docstring
(
escape_byte_string
(
docstr
))))
split_
string_literal
(
escape_byte_string
(
docstr
))))
if
with_pymethdef
:
if
with_pymethdef
:
code
.
put
(
code
.
put
(
"static PyMethodDef %s = "
%
"static PyMethodDef %s = "
%
...
...
Cython/Compiler/StringEncoding.py
View file @
fabe1ee5
...
@@ -185,9 +185,9 @@ def escape_byte_string(s):
...
@@ -185,9 +185,9 @@ def escape_byte_string(s):
append
(
c
)
append
(
c
)
return
join_bytes
(
l
).
decode
(
'ISO-8859-1'
)
return
join_bytes
(
l
).
decode
(
'ISO-8859-1'
)
def
split_
docstring
(
s
):
def
split_
string_literal
(
s
):
# MSVC can't handle long string literals.
# MSVC can't handle long string literals.
if
len
(
s
)
<
2047
:
if
len
(
s
)
<
2047
:
return
s
return
s
else
:
else
:
return
'""'
.
join
([
s
[
i
:
i
+
2000
]
for
i
in
range
(
0
,
len
(
s
),
2000
)])
return
'""'
.
join
([
s
[
i
:
i
+
2000
]
for
i
in
range
(
0
,
len
(
s
),
2000
)])
.
replace
(
r'\""'
,
'""
\
\
'
)
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