New submission from Edward K. Ream:
On both windows and Linux the following fails on Python 2.7:
s = '\\Upsilon'
unicode(s,unicode_escape)
UnicodeDecodeError: 'unicodeescape' codec can't decode bytes in position 0-7:
end of string in escape sequence
BTW, the six.py package uses this
Ezio Melotti added the comment:
This is not a bug, \U should be followed by 8 hex digits and it indicates a
Unicode codepoint:
'\\u0065'.decode('unicode_escape')
u'e'
'\\U0065'.decode('unicode_escape')
u'e'
'\\Upsilon'.decode('unicode_escape')
Traceback (most recent call last):
File
Edward K. Ream added the comment:
Thanks for your quick reply.
If this is not a bug, why does six define six.u as unicode(s,unicode_escape)
for *all* u constants??
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17850
R. David Murray added the comment:
Because as Ezio demonstrated, it produces the same result as using the 'u'
prefix on the same string.
--
nosy: +r.david.murray
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17850
Edward K Ream added the comment:
On Fri, Apr 26, 2013 at 8:51 AM, Edward K. Ream rep...@bugs.python.orgwrote:
If this is not a bug, why does six define six.u as
unicode(s,unicode_escape) for *all* u constants??
Oops. The following works::
s = r'\\Upsilon'