This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author gpolo
Recipients ajaksu2, gpolo, loewis, pitrou, vstinner
Date 2009-01-03.21:24:19
SpamBayes Score 5.45386e-12
Marked as misclassified No
Message-id <ac2200130901031324y11ec5fe6ibd871e332a4b85fa@mail.gmail.com>
In-reply-to <1231016231.37.0.770299680835.issue3638@psf.upfronthosting.co.za>
Content
> These look fine. I think further changes are necessary:
> tkinter/__init__.py tries to load createfilehandler/deletefilehandler;
> this becomes redundant.

Indeed, I forgot to look into the Python code.

I also see as redundant the checks for _tkinter._flatten and
_tkinter._cnfmerge, the former because if we are still on Tkinter.py
(or __init__.py in py3k) then _tkinter exists and _flatten is there
too, the latter because there is no _cnfmerge in _tkinter.

> Also, why did you leave DoOneEvent and Quit
> as-is - don't they fall into the same category?
>

Ah, it is nice you ask this. I was indeed going to move then, but I
noticed strange things with DoOneEvent which made me only remove those
functions that were already checking the thread id of the caller and
the interp creator. But rethinking about this, it seems to make more
sense to do the move now and fix the "strange things" in other patch.
The problems I noticed may be a bit off-topic for this specific issue,
but I would hate to just say I had problems with a function and don't
say which errors I got, and how I got, so I have to write. So, the
problem started when I noticed DoOneEvent doesn't check for python
errors after Tcl_DoOneEvent returns, making me try to get one of those
SystemErrors "NULL result without error" -- I failed to get it, but I
got other unexpected results:

I get an empty string with the text below, but I was expecting some
nameerror message:

import _tkinter

def mybgerror(errmsg):
    print errmsg

called = []
def bad():
    called.append(True)
    raise InvalidThing

x = _tkinter.create()
x.createcommand("bad", bad)
x.createcommand("bgerror", mybgerror)
x.call("after", 1, "bad")

while not called:
    _tkinter.dooneevent()
_tkinter.dooneevent()

I ended up finding another problem (or problems, I forgot to annotate
them), like with call:

import _tkinter

def bad():
    raise InvalidThing

x = _tkinter.create()
x.createcommand("bad", bad)
x.call("bad")

Results in:

Traceback (most recent call last):
  File "my_badtests/test1.py", line 7, in <module>
    x.call("bad")
_tkinter.TclError

Meaning call is overwriting a python error by a tcl error, but since
there was no error in the tcl interpreter the error message was empty
(too many errors in a message).

But these all would deserve another(s) issues, so I will be moving
"quit" and "dooneevent" from there too.

> One minor nit: I personally dislike function pointer casts, because they
> can easily go wrong. I rather prefer if the C compiler tells me when I
> mess up with function pointer types. Hence _tkinter uses selfptr/self
> all the time.
>

Fine.
History
Date User Action Args
2009-01-03 21:24:21gpolosetrecipients: + gpolo, loewis, pitrou, vstinner, ajaksu2
2009-01-03 21:24:20gpololinkissue3638 messages
2009-01-03 21:24:19gpolocreate