Generate shorter string literals
authorChristoph Gohlke <cgohlke@uci.edu>
Fri, 5 Feb 2010 19:19:08 +0000 (11:19 -0800)
committerChristoph Gohlke <cgohlke@uci.edu>
Fri, 5 Feb 2010 19:19:08 +0000 (11:19 -0800)
This is related to <http://trac.cython.org/cython_trac/ticket/50>.

Cython 0.12.1 still generates string literals that can be too long for MSVC*
compilers. Please consider the following patch.

Cython/Compiler/Code.py

index 5d198835151948190edc5394fe244d26b5972d2f..d84c4223bb2d04215005895cf6d95d3eb561d91e 100644 (file)
@@ -667,7 +667,7 @@ class GlobalState(object):
         decls_writer = self.parts['decls']
         for _, cname, c in c_consts:
             decls_writer.putln('static char %s[] = "%s";' % (
-                cname, c.escaped_value))
+                cname, StringEncoding.split_docstring(c.escaped_value)))
             if c.py_strings is not None:
                 for py_string in c.py_strings.itervalues():
                     py_strings.append((c.cname, len(py_string.cname), py_string))