This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: '\u' in unicode raw string raise an syntax error
Type: compile error Stage:
Components: Interpreter Core Versions: Python 2.7, Python 2.6
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: HarryH, amaury.forgeotdarc
Priority: normal Keywords:

Created on 2011-06-03 09:55 by HarryH, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (2)
msg137511 - (view) Author: Hanöfner Harald (HarryH) Date: 2011-06-03 09:55
The follow code:
s = ur"c:\that\is\a\new\unicode\path"

raise the follow error:
SyntaxError: (unicode error) 'rawunicodeescape' codec can't decode bytes in position 10-11: truncated \uXXXX

That is already corrected in Py 3 builds.
msg137513 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2011-06-03 10:11
Even in "raw" unicode strings, \u is processed as an escape sequence; see the very last paragraph of
http://docs.python.org/reference/lexical_analysis.html#string-literals

Yes, this can be surprising, and was changed with Python 3.
Python 2 versions can't be changed for compatibility reasons.
History
Date User Action Args
2022-04-11 14:57:18adminsetgithub: 56461
2011-06-03 10:11:04amaury.forgeotdarcsetstatus: open -> closed

nosy: + amaury.forgeotdarc
messages: + msg137513

resolution: wont fix
2011-06-03 09:55:29HarryHcreate