Guilherme Polo <ggp...@gmail.com> added the comment: > 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. _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue3638> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com