[Python-bugs-list] [ python-Bugs-692416 ] tkinter.createfilehandler dumps core

SourceForge.net noreply@sourceforge.net
Sat, 01 Mar 2003 14:46:36 -0800


Bugs item #692416, was opened at 2003-02-24 13:54
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=692416&group_id=5470

Category: Tkinter
Group: Python 2.3
Status: Open
Resolution: None
Priority: 7
Submitted By: Mike Romberg (romberg)
Assigned to: Martin v. Löwis (loewis)
Summary: tkinter.createfilehandler dumps core

Initial Comment:
  This small example probably uses an invalid
mask and the filedescriptor for a dummy file.  But
I'm seeing this core dump even when using
a correct mask and sockets.  This is with 2.3a2.

>>> import Tkinter
>>> tk = Tkinter.Tk()
>>> fp = open('foo', 'w')
>>> def foo():
...     pass
... 
>>> Tkinter._tkinter.createfilehandler(fp.fileno(), 0, foo)
Segmentation fault (core dumped)


  Here is the traceback:

#0  Tkapp_CreateFileHandler (self=0x0, args=0x1) at
Modules/_tkinter.c:2205
#1  0x080f279a in PyCFunction_Call (func=0x0,
arg=0x40730a68, kw=0x0)
    at Objects/methodobject.c:108
#2  0x080a73cd in call_function (pp_stack=0xbffff2ec,
oparg=1)
    at Python/ceval.c:3285
#3  0x080a58ed in eval_frame (f=0x815700c) at
Python/ceval.c:2041
#4  0x080a630c in PyEval_EvalCodeEx (co=0x40569160,
globals=0x0, locals=0x1, 
    args=0x815700c, argcount=0, kws=0x0, kwcount=0,
defs=0x0, defcount=0, 
    closure=0x0) at Python/ceval.c:2588
#5  0x080a8af7 in PyEval_EvalCode (co=0x1, globals=0x1,
locals=0x1)
    at Python/ceval.c:535
#6  0x080cf25b in run_node (n=0x4015f4e8, 
    filename=0x1 <Address 0x1 out of bounds>,
globals=0x1, locals=0x1, 
    flags=0x1) at Python/pythonrun.c:1105
#7  0x080ce7ae in PyRun_InteractiveOneFlags (fp=0x1, 
    filename=0x80f530a "<stdin>", flags=0xbffff4d8) at
Python/pythonrun.c:609
#8  0x080ce5a3 in PyRun_InteractiveLoopFlags
(fp=0x421271c0, 
    filename=0x80f530a "<stdin>", flags=0x40569160) at
Python/pythonrun.c:542
#9  0x080cfae2 in PyRun_AnyFileExFlags (fp=0x421271c0, 
    filename=0x80f530a "<stdin>", closeit=0,
flags=0xbffff4d8)
    at Python/pythonrun.c:505
#10 0x08054909 in Py_Main (argc=0, argv=0xbffff544) at
Modules/main.c:446
#11 0x0805448b in main (argc=1, argv=0x1) at
Modules/python.c:23
#12 0x420158d4 in __libc_start_main () from
/lib/i686/libc.so.6


----------------------------------------------------------------------

>Comment By: Neal Norwitz (nnorwitz)
Date: 2003-03-01 17:46

Message:
Logged In: YES 
user_id=33168

The problem is that CHECK_TCL_APPARTMENT is called in
Tkapp_CreateFileHandler() and Tkapp_DeleteFileHandler(). 
The CHECK_TCL_APPARTMENT macro uses self which is NULL when
called through the module.  Checking if (self == NULL)
before calling CHECK_TCL_APPARTMENT would prevent the crash,
but I'm not certain this is correct.

As a workaround, you should be able to access create/delete
filehandler through the instance:

   w.tk.createfilehandler(...)

instead of Tkinter.createfilehandler(...).

----------------------------------------------------------------------

Comment By: Neal Norwitz (nnorwitz)
Date: 2003-02-25 22:10

Message:
Logged In: YES 
user_id=33168

Confirmed the core dump on Linux with Tk 8.3.  Hopefully
Martin will be back soon.  If not I'll try to take a look.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=692416&group_id=5470