From: ChrisPerkins Date: Sat, 29 Mar 2008 20:58:40 +0000 (-0700) Subject: Fix bug 208262 for files with odd characters in them X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=f441bb7db325763d3945e6761ddb5aa6b290a292;p=cython.git Fix bug 208262 for files with odd characters in them --- diff --git a/Cython/Compiler/Main.py b/Cython/Compiler/Main.py index c50b1a98..ca8dc88d 100644 --- a/Cython/Compiler/Main.py +++ b/Cython/Compiler/Main.py @@ -2,7 +2,7 @@ # Cython Top Level # -import os, sys +import os, sys, re if sys.version_info[:2] < (2, 2): print >>sys.stderr, "Sorry, Cython requires Python 2.2 or later" sys.exit(1) @@ -166,7 +166,9 @@ class Context: cwd = os.getcwd() if full_module_name is None: - full_module_name, _ = os.path.splitext(source.replace('/', '.')) + full_module_name, _ = os.path.splitext(source) + full_module_name = re.sub(r'[\\/]', '.', full_module_name) + full_module_name = re.sub(r'[^\w.]', '_', full_module_name) source = os.path.join(cwd, source)