Issue1040
Created on 2008-05-25.05:50:29 by leosoto, last changed 2008-05-25.23:37:15 by pjenvey.
File name |
Uploaded |
Description |
Edit |
Remove |
keyerror.patch
|
leosoto,
2008-05-25.05:57:28
|
|
|
|
msg3202 (view) |
Author: Leonardo Soto (leosoto) |
Date: 2008-05-25.05:50:16 |
|
On CPython, KeyError.__str__ is special, because it uses repr() of the
exception argument instead of str(). Here is the reason, from exceptions.c:
If args is a tuple of exactly one item, apply repr to args[0].
This is done so that e.g. the exception raised by {}[''] prints
KeyError: ''
rather than the confusing
KeyError
alone. The downside is that if KeyError is raised with an
explanatory
string, that string will be displayed in quotes. Too bad.
If args is anything else, use the default BaseException__str__().
Currently, Jython doesn't match this behaviour.
|
msg3203 (view) |
Author: Leonardo Soto (leosoto) |
Date: 2008-05-25.05:57:27 |
|
Patch, including test case attached
|
msg3206 (view) |
Author: Philip Jenvey (pjenvey) |
Date: 2008-05-25.23:37:08 |
|
fixed in r4448-4449. I mistakenly didn't notice your patch originally when
I did this on r4448 (the pep352 branch), that's why I committed a slightly
different version of the test. Oops
|
|
Date |
User |
Action |
Args |
2008-05-25 23:37:15 | pjenvey | set | status: open -> closed resolution: fixed messages:
+ msg3206 nosy:
+ pjenvey |
2008-05-25 05:57:29 | leosoto | set | files:
+ keyerror.patch messages:
+ msg3203 |
2008-05-25 05:50:30 | leosoto | create | |
|