[issue7309] crasher in str(Exception())

Walter Dörwald report at bugs.python.org
Mon Nov 16 10:49:57 CET 2009


Walter Dörwald <walter at livinglogic.de> added the comment:

>> I'm not sure what the functions should do when start and end are
>> out of range.
>
> I think the best approach would be to prevent these values to be out of
> range in the first place. 

The start and end values should be clipped, just like normal slices in
Python do:

>>> ""[2**30:2**30+1]
''

> I agree there's not much value in making the attributes read/write,
> but it looks like all of the exceptions allow it, so I don't really
> want to make these exceptions the only ones that are different.

Exception attributes *must* be read/write, because the codecs create an
exception object once, and then uses this exception object to
communicate multiple errors to the callback. PEP 293 states: "Should
further encoding errors occur, the encoder is allowed to reuse the
exception object for the next call to the callback."

----------
nosy: +doerwalter

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7309>
_______________________________________


More information about the Python-bugs-list mailing list