From f441bb7db325763d3945e6761ddb5aa6b290a292 Mon Sep 17 00:00:00 2001 From: ChrisPerkins Date: Sat, 29 Mar 2008 13:58:40 -0700 Subject: [PATCH] Fix bug 208262 for files with odd characters in them --- Cython/Compiler/Main.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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) -- 2.26.2