Split docstring around \n for compilers who barf at long string literals (VS 2003).
authordavid@evans-2.local <none@none>
Fri, 15 Aug 2008 14:06:05 +0000 (09:06 -0500)
committerdavid@evans-2.local <none@none>
Fri, 15 Aug 2008 14:06:05 +0000 (09:06 -0500)
Cython/Compiler/Nodes.py
Cython/Compiler/StringEncoding.py

index 053d7d234849604275083a3e401bc1b68e65d3be..d1a418c958d92cfa9e375e41d3ebaae6840cff1c 100644 (file)
@@ -13,7 +13,7 @@ from PyrexTypes import py_object_type, error_type, CTypedefType, CFuncType
 from Symtab import ModuleScope, LocalScope, GeneratorLocalScope, \
     StructOrUnionScope, PyClassScope, CClassScope
 from Cython.Utils import open_new_file, replace_suffix
-from StringEncoding import EncodedString, escape_byte_string
+from StringEncoding import EncodedString, escape_byte_string, split_docstring
 import Options
 import ControlFlow
 
@@ -1533,7 +1533,7 @@ class DefNode(FuncDefNode):
             code.putln(
                 'static char %s[] = "%s";' % (
                     self.entry.doc_cname,
-                    escape_byte_string(docstr)))
+                    split_docstring(escape_byte_string(docstr))))
         if with_pymethdef:
             code.put(
                 "static PyMethodDef %s = " % 
index b34758020fba8f92ff8706bdc5c49bf7cd28450f..93b4a9a23c6384816c11f7180b053a98ec6fcc40 100644 (file)
@@ -142,3 +142,6 @@ def escape_byte_string(s):
         else:
             append(c)
     return ''.join(l)
+
+def split_docstring(s):
+    return '\\n\"\"'.join(s.split(r'\n'))