always use decoded filenames in FileSourceDescriptor
authorStefan Behnel <scoder@users.berlios.de>
Wed, 30 Jun 2010 20:05:58 +0000 (22:05 +0200)
committerStefan Behnel <scoder@users.berlios.de>
Wed, 30 Jun 2010 20:05:58 +0000 (22:05 +0200)
Cython/Compiler/Annotate.py
Cython/Compiler/Main.py
Cython/Compiler/Scanning.py
Cython/Utils.py

index d2dbb6a0154694fda5b464841a75ccdad8c8a97a..425d956e89e48eeb59682f2519bcce4565cb73c8 100644 (file)
@@ -127,7 +127,7 @@ function toggleDiv(id) {
         """)
         f.write(u'<body>\n')
         f.write(u'<p>Generated by Cython %s on %s\n' % (Version.version, time.asctime()))
-        c_file = Utils.encode_filename(os.path.basename(target_filename))
+        c_file = Utils.decode_filename(os.path.basename(target_filename))
         f.write(u'<p>Raw output: <a href="%s">%s</a>\n' % (c_file, c_file))
         k = 0
         
index b06b116ddb35766f348a6ba796be5f50f8061fad..a9c7c3b89d0dabed2ee63094824243131d604a8b 100644 (file)
@@ -479,7 +479,7 @@ class Context(object):
     def parse(self, source_desc, scope, pxd, full_module_name):
         if not isinstance(source_desc, FileSourceDescriptor):
             raise RuntimeError("Only file sources for code supported")
-        source_filename = Utils.encode_filename(source_desc.filename)
+        source_filename = source_desc.filename
         scope.cpp = self.cpp
         # Parse the given source file and return a parse tree.
         try:
index 7e99b773322ccfbe525ed82774bc5a966457dd6e..44a27315932dd6cfcae935db2a7ef6f713775fd7 100644 (file)
@@ -166,6 +166,7 @@ class FileSourceDescriptor(SourceDescriptor):
     the position()-tuple.
     """
     def __init__(self, filename):
+        filename = Utils.decode_filename(filename)
         self.filename = filename
         self.set_file_type_from_name(filename)
         self._cmp_name = filename
index 48877c7b212811d508b12a6a4d163be10be82330..deaab7ffa93b54daed71088123a0980f957ee2d4 100644 (file)
@@ -66,9 +66,9 @@ def path_exists(path):
         pass
     return False
 
-# support for source file encoding detection
+# file name encodings
 
-def encode_filename(filename):
+def decode_filename(filename):
     if isinstance(filename, unicode):
         return filename
     try:
@@ -80,6 +80,8 @@ def encode_filename(filename):
         pass
     return filename
 
+# support for source file encoding detection
+
 _match_file_encoding = re.compile(u"coding[:=]\s*([-\w.]+)").search
 
 def detect_file_encoding(source_filename):