make sure header filenames pass literally into the C code
authorStefan Behnel <scoder@users.berlios.de>
Mon, 6 Jul 2009 09:51:50 +0000 (11:51 +0200)
committerStefan Behnel <scoder@users.berlios.de>
Mon, 6 Jul 2009 09:51:50 +0000 (11:51 +0200)
Cython/Compiler/ModuleNode.py
Cython/Compiler/StringEncoding.py

index be9a8dd4ec741dbe80d7986e219cca702b8c09e7..74dd816a9fb862ee70f73d3162ecd45ef3461651 100644 (file)
@@ -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("")
index 2c6aa07fe4b975e65be85c931d09b90db58fe493..e7db555ba14c42b266b14d349db72144f583939e 100644 (file)
@@ -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 = {