Issue 5447: future unicode literals and r'\u'
Issue5447
Created on 2009-03-08 20:11 by pooryorick, last changed 2022-04-11 14:56 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| raw-unicode-literals.patch | zhirsch, 2009-03-09 08:55 | |||
| Messages (4) | |||
|---|---|---|---|
| msg83326 - (view) | Author: Poor Yorick (pooryorick) * | Date: 2009-03-08 20:11 | |
from __future__ import unicode_literals print(r'\u.bug') SyntaxError: (unicode error) truncated \uXXXX |
|||
| msg83327 - (view) | Author: Benjamin Peterson (benjamin.peterson) * ![]() |
Date: 2009-03-08 20:17 | |
This happens with unicode literals even without "from __future__ import unicode_literals" because raw strings still have \u escapes interpreted. This isn't true in 3.0, so it would be nice to disable it with unicode_literals. |
|||
| msg83363 - (view) | Author: Zach Hirsch (zhirsch) | Date: 2009-03-09 08:55 | |
I've hit this, too, and it's annoyed me. So here's a patch against trunk that should fix it. The idea is: whenever unicode_literals are turned on (or the -U command line flag is passed), to convert r"\u" to "\u005c\u0075" and r"\U" to "\u005c\u0055" for every string literal in the source file before passing the string to PyUnicode_DecodeRawUnicodeEscape. |
|||
| msg102084 - (view) | Author: Florent Xicluna (flox) * ![]() |
Date: 2010-04-01 11:44 | |
Duplicate of #2570. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:56:46 | admin | set | github: 49697 |
| 2010-04-01 11:45:37 | flox | set | superseder: backport 3.0-style \u/\U processing in raw strings when unicode_literals is imported from __future__ |
| 2010-04-01 11:44:21 | flox | set | status: open -> closed nosy:
+ flox resolution: duplicate |
| 2009-03-09 08:55:13 | zhirsch | set | files:
+ raw-unicode-literals.patch nosy:
+ zhirsch keywords: + patch |
| 2009-03-08 20:17:32 | benjamin.peterson | set | priority: normal versions: + Python 2.7, - Python 2.6 nosy: + benjamin.peterson messages: + msg83327 type: compile error -> enhancement |
| 2009-03-08 20:11:31 | pooryorick | create | |
