From: Stefan Behnel Date: Fri, 18 Jul 2008 06:40:20 +0000 (+0200) Subject: always convert byte-docstrings into unicode strings X-Git-Tag: 0.9.8.1~124 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=0510cac958ee53a63506a67e80a452067d8ce8ff;p=cython.git always convert byte-docstrings into unicode strings --- diff --git a/Cython/Compiler/Parsing.py b/Cython/Compiler/Parsing.py index cda156d1..3ed1dea2 100644 --- a/Cython/Compiler/Parsing.py +++ b/Cython/Compiler/Parsing.py @@ -8,7 +8,7 @@ from Scanning import PyrexScanner, FileSourceDescriptor import Nodes import ExprNodes from ModuleNode import ModuleNode -from Errors import error, InternalError +from Errors import error, warning, InternalError from Cython import Utils import Future @@ -2151,9 +2151,14 @@ def p_property_decl(s): def p_doc_string(s): if s.sy == 'BEGIN_STRING': - _, result = p_cat_string_literal(s) + pos = s.position() + kind, result = p_cat_string_literal(s) if s.sy != 'EOF': s.expect_newline("Syntax error in doc string") + if kind != 'u': + # warning(pos, "Python 3 requires docstrings to be unicode strings") + if kind == 'b': + result.encoding = None # force a unicode string return result else: return None