[Patches] [ python-Patches-710127 ] Make "%c" % u"a" work
SourceForge.net
noreply@sourceforge.net
Wed, 02 Apr 2003 08:53:39 -0800
Patches item #710127, was opened at 2003-03-26 17:08
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=710127&group_id=5470
Category: Core (C code)
Group: None
>Status: Closed
Resolution: Accepted
Priority: 5
Submitted By: Walter Dörwald (doerwalter)
Assigned to: Martin v. Löwis (loewis)
>Summary: Make "%c" % u"a" work
Initial Comment:
Currently "%c" % u"a" fails, while "%s" % u"a" works.
This patch fixes this problem.
----------------------------------------------------------------------
>Comment By: Walter Dörwald (doerwalter)
Date: 2003-04-02 18:53
Message:
Logged In: YES
user_id=89016
OK, I've checked in the OverflowError change as:
Objects/unicodeobject.c 2.185
Misc/NEWS 1.710
Lib/test/test_unicode.py 1.82
Closing the patch.
----------------------------------------------------------------------
Comment By: Martin v. Löwis (loewis)
Date: 2003-04-01 00:16
Message:
Logged In: YES
user_id=21627
I can't see why "%c" % 256 should pass; interpreting the 256
as a Unicode ordinal is stretching things too much (if 256
was a Unicode ordinal, then 255 should be a Unicode ordinal
too, and you would have to take into account the system
encoding).
I would think it would be consistent if both gave
OverflowError (Result too large to be represented); this
deserves another NEWS entry.
----------------------------------------------------------------------
Comment By: Walter Dörwald (doerwalter)
Date: 2003-03-31 20:36
Message:
Logged In: YES
user_id=89016
Checked in as:
Misc/NEWS 1.708
Objects/stringobject.c 2.206
Lib/test/test_unicode.py 1.80
Lib/test/test_str.py 1.2
Lib/test/string_tests.py 1.30
BTW "%c" % 256 still fails. Should this be fixed too?
"%c" % 256 raises an OverflowError now, u"%c" %
sys.maxunicode+1 raises a ValueError. At least they should
be changed to raise the same exception. If we fix "%c" % 256
what about chr()?
----------------------------------------------------------------------
Comment By: Martin v. Löwis (loewis)
Date: 2003-03-29 15:18
Message:
Logged In: YES
user_id=21627
Looks fine, please apply it. Also add a test case that fails
now but passes with the change, and add a NEWS entry.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=710127&group_id=5470