]> granicus.if.org Git - python/commitdiff
#2541 Allow unicode escapes in raw strings
authorBenjamin Peterson <benjamin@python.org>
Thu, 3 Apr 2008 16:27:27 +0000 (16:27 +0000)
committerBenjamin Peterson <benjamin@python.org>
Thu, 3 Apr 2008 16:27:27 +0000 (16:27 +0000)
Lib/test/test_unicode.py
Python/ast.c

index f7e7cb426485c51b80f7e2559be5a5ac0bbd2675..63e10af6ba012972f1e02e1274d339b4d61f4499 100644 (file)
@@ -68,6 +68,8 @@ class UnicodeTest(
         self.assertRaises(SyntaxError, eval, '\'\\Ufffffffe\'')
         self.assertRaises(SyntaxError, eval, '\'\\Uffffffff\'')
         self.assertRaises(SyntaxError, eval, '\'\\U%08x\'' % 0x110000)
+        # Test that raw mode does unicode escapes
+        self.assertEqual(r"\u0020", " ")
 
     def test_repr(self):
         if not sys.platform.startswith('java'):
index 6a9658a97424a4b2d08f064a1941e236a555e145..218436f2054fa2e2bf1c020755c5b2b7973e3e7d 100644 (file)
@@ -3231,7 +3231,7 @@ parsestr(struct compiling *c, const node *n, int *bytesmode)
             return NULL;
         }
     }
-    if (!*bytesmode && !rawmode) {
+    if (!*bytesmode) {
         return decode_unicode(s, len, rawmode, c->c_encoding);
     }
     if (*bytesmode) {