classification
Title: tkinter.mainloop() is meaningless and crash: remove it
Type: crash Stage:
Components: Library (Lib) Versions: Python 3.0, Python 2.6
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: ajaksu2, gpolo, haypo
Priority: Keywords: patch

Created on 2008-08-21 22:00 by haypo, last changed 2008-09-13 14:22 by gpolo.

Files
File name Uploaded Description Edit Remove
tkinter_remove_mainloop.patch haypo, 2008-08-21 22:00 Remove _tkinter.mainloop() method, but keep _tkinter.Tkapp().mainloop()
Messages
msg71691 (view) Author: STINNER Victor (haypo) Date: 2008-08-21 22:00
mainloop() is a method of a Tkapp object, but it's also a method of 
_tkinter module. In TkApp_MainLoop, self is seen as a TkappObject 
whereas it can be a module object! So instruction 
like "self->dispatch=1" will replace a random byte in the module 
object (eg. ob_type attribute). Example to crash:
  import gc
  import _tkinter
  _tkinter.mainloop()
  gc.collect()

It always crashs in my Python 3.0, but not in Python 2.6.

Solution: just remove _tkinter.mainloop() => it should have no side 
effect since users use tkinter (without the "_") which only uses 
Tkapp.mainloop() (the right way to use Tkapp_MainLoop() function). 
Solution "implemented" in the patch.
msg73188 (view) Author: Guilherme Polo (gpolo) Date: 2008-09-13 14:19
Looks fine to me. 
But I can't see the reason to keep this as a module function in python
2.6 so I would remove it there too.
History
Date User Action Args
2008-09-13 14:22:24gpolosettitle: tkinter.mainloop() is meanling less and crash: remove it -> tkinter.mainloop() is meaningless and crash: remove it
2008-09-13 14:19:58gpolosetnosy: + gpolo
messages: + msg73188
2008-08-26 00:52:57ajaksu2setnosy: + ajaksu2
2008-08-21 22:00:13haypocreate