From 11955ff6551196caec62e31408f257080cce70a1 Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Mon, 6 Jul 2009 11:51:50 +0200 Subject: [PATCH] make sure header filenames pass literally into the C code --- Cython/Compiler/ModuleNode.py | 3 ++- Cython/Compiler/StringEncoding.py | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) 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 = { -- 2.26.2