Split long string literals at 2000 chars.
authorRobert Bradshaw <robertwb@math.washington.edu>
Fri, 5 Feb 2010 19:28:37 +0000 (11:28 -0800)
committerRobert Bradshaw <robertwb@math.washington.edu>
Fri, 5 Feb 2010 19:28:37 +0000 (11:28 -0800)
(There may not be enough line breaks...)

Cython/Compiler/StringEncoding.py

index 8f97b15d06eba1f9fac0189340f1887098b1731c..cd790014391c9871809051a7c6a07b0dc8daadde 100644 (file)
@@ -186,6 +186,8 @@ def escape_byte_string(s):
         return join_bytes(l).decode('ISO-8859-1')
 
 def split_docstring(s):
+    # MSVC can't handle long string literals.
     if len(s) < 2047:
         return s
-    return '\\n\"\"'.join(s.split(r'\n'))
+    else:
+        return '""'.join([s[i:i+2000] for i in range(0, len(s), 2000)])