From: Benjamin Peterson Date: Thu, 3 Apr 2008 16:27:27 +0000 (+0000) Subject: #2541 Allow unicode escapes in raw strings X-Git-Tag: v3.0a5~153 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7afb766c5dcb1e3caef9ca4c09df055933eede1b;p=thirdparty%2FPython%2Fcpython.git #2541 Allow unicode escapes in raw strings --- diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py index f7e7cb426485..63e10af6ba01 100644 --- a/Lib/test/test_unicode.py +++ b/Lib/test/test_unicode.py @@ -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'): diff --git a/Python/ast.c b/Python/ast.c index 6a9658a97424..218436f2054f 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -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) {