[New-bugs-announce] [issue3638] tkinter.mainloop() is meanling less and crash: remove it

STINNER Victor report at bugs.python.org
Fri Aug 22 00:00:14 CEST 2008


New submission from STINNER Victor <victor.stinner at haypocalc.com>:

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.

----------
components: Library (Lib)
files: tkinter_remove_mainloop.patch
keywords: patch
messages: 71691
nosy: haypo
severity: normal
status: open
title: tkinter.mainloop() is meanling less and crash: remove it
type: crash
versions: Python 2.6, Python 3.0
Added file: http://bugs.python.org/file11200/tkinter_remove_mainloop.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3638>
_______________________________________


More information about the New-bugs-announce mailing list