[Python-bugs-list] [Bug #117167] _tkinter module segfaults on syntax error

noreply@sourceforge.net noreply@sourceforge.net
Wed, 18 Oct 2000 04:52:23 -0700


Bug #117167, was updated on 2000-Oct-18 04:52
Here is a current snapshot of the bug.

Project: Python
Category: Tkinter
Status: Open
Resolution: None
Bug Group: None
Priority: 5
Summary: _tkinter module segfaults on syntax error

Details: The following listing contains a syntax error (remarked by
a comment ) which causes the python interpreter to segfault
inside _tkinter module.
the problem has been verified on Python 2.0 compiled from source on Debian GNU/Linux 2.2. It was also present on Python 1.6, on the same platform as well as on SUN/Solaris 7.0 (still compiled with gcc).
#
# --- begin listing
#
from Tkinter import *
from string import *



    
# ============================================================================
class DemoWindow( Toplevel ):
    """
    <snip>
    """
    instance = None
    
    def __init__( self,  introduction, code_file ):
        Toplevel.__init__(self)
        
        DemoWindow.instance = self

        # store object attributes
        self.code_file = code_file

        # create and pack the introduction label
        intro_label=Label(self, text=introduction)
        intro_label.pack(side=TOP)

        # this is the frame which contains the two buttons at the end
        button_frame = Frame( self )
        button_frame.pack( side=BOTTOM, pady='2m', fill=X )
        


# --- button.py
# This module demonstrates simple buttons
# It is meant to be called by the demo widget main module
# but it can also run stand-alone
#

class ButtonsDemoWindow( DemoWindow ):
    """
    A demo window with some buttons which changes the demo
    window behaviour
    """
    def __init__( self ):
        intro="""If you click on any of the four buttons below, the background
        <SNIP>
        invoke the current button."""

        # BUG ! This is the syntax error which triggers the bug.        
        DemoWindow(self, intro )
        # It should have been DemoWindow.__init__(self, intro, 'problem.py')

        frame=Frame()
        frame.pack(expand=YES, fill=BOTH )
        for c in ('Peach Puff', 'Light Blue1',
                  'Sea Green2', 'Yellow1' ):
            b = Button(self, text=c)
            b['command'] = callit( self.callback, c );
            
            b.pack( side=top, expand=yes, pady=2,
                    command=callit(self.callback, color) )

    def callback(self, color):
        self.frame['background']=color
            



if __name__ == '__main__':
    ButtonsDemoWindow() 
    mainloop()
 

For detailed info, follow this link:
http://sourceforge.net/bugs/?func=detailbug&bug_id=117167&group_id=5470