[Python-3000] idle3.0 - is is supposed to work?

James Brotchie brotchie at gmail.com
Sat Aug 11 02:51:15 CEST 2007


On 8/10/07, "Martin v. Löwis" <martin at v.loewis.de> wrote:
>
> >>> OTOH, IDLE ran w/o this error in p3yk...
> >> Yes. Somebody would have to study what precisely the problem is: is it
> >> that there is a None key in that dictionary, and that you must not use
> >> None as a tag name? In that case: where does the None come from?
> >> Or else: is it that you can use None as a tagname in 2.x, but can't
> >> anymore in 3.0? If so: why not?
> >
> > OK, I'll start looking at it.
>
So did I, somewhat. It looks like a genuine bug in IDLE to me: you
> can't use None as a tag name, AFAIU. I'm not quite sure why this
> doesn't cause an exception in 2.x; if I try to give a None tag
> separately (i.e. in a stand-alone program) in 2.5,
> it gives me the same exception.


In 2.x the 'tag configure None' call does indeed raise a TclError, this can
been seen by trapping calls to Tkinter_Error in _tkinter.c and outputting
the Tkapp_Result.

For some reason on py3k this TclError doesn't get caught anywhere, whilst in
2.x it either gets caught or just disappears.

This behaviour can be demonstrated with:

    def config_colors(self):
        for tag, cnf in self.tagdefs.items():
            if cnf:
                try:
                    self.tag_configure(tag, **cnf)
                except:
                    sys.exit(1)
        self.tag_raise('sel')

on py3k the exception is caught and execution stops
on 2.x no exception is caught and execution continues (however Tkinter_Error
is still called during Tkiner_Call execution!?)

tag_configure doesn't behave this way when used in a trivial stand-alone
program, must be some obscurity within idle.

I'm confused....

James
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-3000/attachments/20070811/c62dff31/attachment.htm 


More information about the Python-3000 mailing list