From 4479643daf4e4ec53976697fab6183e708874c42 Mon Sep 17 00:00:00 2001 From: "david@evans-2.local" Date: Fri, 15 Aug 2008 09:06:05 -0500 Subject: [PATCH] Split docstring around \n for compilers who barf at long string literals (VS 2003). --- Cython/Compiler/Nodes.py | 4 ++-- Cython/Compiler/StringEncoding.py | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Cython/Compiler/Nodes.py b/Cython/Compiler/Nodes.py index 053d7d23..d1a418c9 100644 --- a/Cython/Compiler/Nodes.py +++ b/Cython/Compiler/Nodes.py @@ -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 = " % diff --git a/Cython/Compiler/StringEncoding.py b/Cython/Compiler/StringEncoding.py index b3475802..93b4a9a2 100644 --- a/Cython/Compiler/StringEncoding.py +++ b/Cython/Compiler/StringEncoding.py @@ -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')) -- 2.26.2