From: Stefan Behnel Date: Mon, 6 Jul 2009 09:51:50 +0000 (+0200) Subject: make sure header filenames pass literally into the C code X-Git-Tag: 0.12.alpha0~258 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=11955ff6551196caec62e31408f257080cce70a1;p=cython.git make sure header filenames pass literally into the C code --- diff --git a/Cython/Compiler/ModuleNode.py b/Cython/Compiler/ModuleNode.py index be9a8dd4..74dd816a 100644 --- a/Cython/Compiler/ModuleNode.py +++ b/Cython/Compiler/ModuleNode.py @@ -591,7 +591,8 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): def generate_includes(self, env, cimported_modules, code): includes = [] for filename in env.include_files: - code.putln('#include "%s"' % filename) + # fake decoding of filenames to their original byte sequence + code.putln('#include "%s"' % filename.as_unicode()) def generate_filename_table(self, code): code.putln("") diff --git a/Cython/Compiler/StringEncoding.py b/Cython/Compiler/StringEncoding.py index 2c6aa07f..e7db555b 100644 --- a/Cython/Compiler/StringEncoding.py +++ b/Cython/Compiler/StringEncoding.py @@ -89,6 +89,12 @@ class BytesLiteral(_bytes): def utf8encode(self): assert False, "this is not a unicode string: %r" % self + def as_unicode(self): + """Returns a Unicode sequence that matches the byte sequence + of this literal. + """ + return self.decode('ISO-8859-1') + is_unicode = False char_from_escape_sequence = {