[issue16023] IDLE freezes on ^5 or ^6 (Un-)Tabify Region with OS X Cocoa Tk 8.5

Ronald Oussoren report at bugs.python.org
Sun Jul 7 12:29:43 CEST 2013


Ronald Oussoren added the comment:

Interestingly enough it seems to hang while handling an import error, when  I break executation and look at the stack trace I see (amongst others):


#5  0x00000001000b11f1 in import_all_from [inlined] () at /Users/ronald/Projects/python/rw/default/Python/ceval.c:4614
4614	            PyErr_SetString(PyExc_ImportError,
(gdb) l
4609	        PyErr_Clear();
4610	        dict = _PyObject_GetAttrId(v, &PyId___dict__);
4611	        if (dict == NULL) {
4612	            if (!PyErr_ExceptionMatches(PyExc_AttributeError))
4613	                return -1;
4614	            PyErr_SetString(PyExc_ImportError,
4615	            "from-import-* object has no __dict__ and no __all__");
4616	            return -1;
4617	        }
4618	        all = PyMapping_Keys(dict);
(gdb) 


This is with an optimized build, the debugger isn't as useful as I'd like and some information seem suspect (such as a frame object with an obviously invalid value for f_code.

This is probably a red herring, I haven't been able to reproduce this particular problem with a debug build.

In the production build I got a (non-functional) popup for entering some information, in the debug build I don't even get that and the proces hangs in CFRunLoopRunSpecific (called by Tk). And that's due to a call to "tkwait window ..." (aka the "wait_window" method from tkinter.Misc).

Debugging is slightly annoying because 'pyo' from the gdb macros works, but the printing a python stack trace does not.

The call is eventually traceable to calling simpledialog.askinteger in EditorWindow.tabify_region_event (through _asktabwidth) and is likely a bug where TkCocoa doesn't like callbacks into Tk from an event handler (IIRC we've had those before)

A quick hack to test this theorie is to redefine tabify_region_event:

    def tabify_region_event(self, event):
        self.after(200, lambda: self._tabify_region_event(event))

    def _tabify_region_event(self, event):
        # original method


This doesn't actually help, IDLE still hangs and my theory is likely wrong.

The easiest workaround is likely to give up for now and disable the ^5 and ^6 shortcuts (as well as ^3 and ^4 as those don't crash but don't do anything either, while the menu entries do work).

Annoyingly other commands in the format menu work just fine (CTRL-T, CMD-], CMD-[)



(all of this with the tip of the default branch and a freshly installed copy of ActiveTcl 8.5 on OSX 10.8)

----------

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


More information about the Python-bugs-list mailing list