fix byte string escaping of '\' in Py2.x (broken by latest Py3 fixes)
authorStefan Behnel <scoder@users.berlios.de>
Wed, 8 Jul 2009 18:24:13 +0000 (20:24 +0200)
committerStefan Behnel <scoder@users.berlios.de>
Wed, 8 Jul 2009 18:24:13 +0000 (20:24 +0200)
Cython/Compiler/StringEncoding.py

index 346de59d4b8f3d0763721bf9435f15781b8d56be..618c99d7f2868be8355858e1e0cc7b3ad0d7a70a 100644 (file)
@@ -126,7 +126,7 @@ _c_special_replacements = [(orig.encode('ASCII'),
 def _build_specials_test():
     subexps = []
     for special in _c_special:
-        regexp = ''.join(['[%s]' % c for c in special])
+        regexp = ''.join(['[%s]' % c.replace('\\', '\\\\') for c in special])
         subexps.append(regexp)
     return re.compile('|'.join(subexps).encode('ASCII')).search