On 9/5/06, M.-A. Lemburg <[EMAIL PROTECTED]> wrote:
That was my bug reaction and what I said on the bug report. Kind of surprised one doesn't already exist.
Neal, do you want to rip it out or should I?
-Brett
Brett Cannon wrote:
> On 9/4/06, Neal Norwitz <[EMAIL PROTECTED]> wrote:
>>
>> There are 3 bugs currently listed in PEP 356 as blocking:
>> http://python.org/sf/1551432 - __unicode__ breaks on exception
>> classes
>
>
> I replied on the bug report, but might as well comment here.
>
> The problem with this bug is that BaseException now defines a __unicode__()
> method in its PyMethodDef. That intercepts the unicode() call on the class
> and it complains it was not handed an instance. I guess the only way to
> fix this is to toss out the __unicode__() method and change the tp_str function
> to return Unicode as needed (unless someone else has a better idea). Or
> the bug can be closed as Won't Fix.
The proper fix would be to introduce a tp_unicode slot and let
this decide what to do, ie. call .__unicode__() methods on instances
and use the .__name__ on classes.
That was my bug reaction and what I said on the bug report. Kind of surprised one doesn't already exist.
I think this would be the right way to go for Python 2.6. For
Python 2.5, just dropping this .__unicode__ method on exceptions
is probably the right thing to do.
Neal, do you want to rip it out or should I?
-Brett
_______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com