summaryrefslogtreecommitdiff
path: root/Cython/Compiler/StringEncoding.py
diff options
context:
space:
mode:
authorStefan Behnel <stefan_ml@behnel.de>2015-08-08 18:02:24 +0200
committerStefan Behnel <stefan_ml@behnel.de>2015-08-08 18:02:24 +0200
commitdcc84ee5e78f009b697294896f040ac7b2a7e7f5 (patch)
tree8de4e05fda45aec567d308820d53f80dc12f3fde /Cython/Compiler/StringEncoding.py
parent8dc18957903e56c2a54fea5ffdf568a6eb1b545f (diff)
downloadcython-dcc84ee5e78f009b697294896f040ac7b2a7e7f5.tar.gz
clean up and fix docstring serialisation (some are const, some are not)
Diffstat (limited to 'Cython/Compiler/StringEncoding.py')
-rw-r--r--Cython/Compiler/StringEncoding.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Cython/Compiler/StringEncoding.py b/Cython/Compiler/StringEncoding.py
index 5c1a85576..ccc66694d 100644
--- a/Cython/Compiler/StringEncoding.py
+++ b/Cython/Compiler/StringEncoding.py
@@ -136,6 +136,9 @@ class EncodedString(_unicode):
def contains_surrogates(self):
return string_contains_surrogates(self)
+ def as_utf8_string(self):
+ return BytesLiteral(self.utf8encode())
+
def string_contains_surrogates(ustring):
"""
@@ -177,6 +180,10 @@ class BytesLiteral(_bytes):
is_unicode = False
+ def as_c_string_literal(self):
+ value = split_string_literal(escape_byte_string(self))
+ return '"%s"' % value
+
char_from_escape_sequence = {
r'\a' : u'\a',