Message2822

Author pjenvey
Recipients
Date 2007-09-11.04:49:04
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
Actually I spoke too soon, there's one issue -- this patch will break formatting unicode chars with values larger than 255:

Jython 2.3a0 on java1.5.0_07
Type "copyright", "credits" or "license" for more information.
>>> u'%c' % 256
Traceback (innermost last):
  File "<console>", line 1, in ?
OverflowError: unsigned byte integer is greater than maximum

Without the patch jython *appears* to handle these values as CPython does, but I suspect there may be more involved, as the exception raised by CPython when the unicode formatting fails seems to suggest that CPython runs the value through something similar to unichr():

Python 2.4.4 (#1, Aug 19 2007, 19:54:52) 
[GCC 4.0.1 (Apple Computer, Inc. build 5367)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> u'%c' % 256
u'\u0100'
>>> u'%c' % -1
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
OverflowError: %c arg not in range(0x10000) (narrow Python build)
>>> unichr(-1)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
ValueError: unichr() arg not in range(0x10000) (narrow Python build)
History
Date User Action Args
2008-02-20 17:18:47adminlinkissue1780767 messages
2008-02-20 17:18:47admincreate