Commit bcfa729f authored by Stefan Behnel's avatar Stefan Behnel

always use decoded filenames in FileSourceDescriptor

parent 96b2e5a1
......@@ -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
......
......@@ -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:
......
......@@ -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
......
......@@ -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):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment