bpo-23544: IDLE hangs when selecting Stack Viewer with debug active

"Stack Viewer" is now disabled when user code is running.
This commit is contained in:
Zackery Spytz 2019-11-14 23:41:43 -07:00
parent 3f8cebd32c
commit 152d306158
3 changed files with 9 additions and 1 deletions

View File

@ -449,7 +449,9 @@ class EditorWindow(object):
self.menudict = menudict = {} self.menudict = menudict = {}
for name, label in self.menu_specs: for name, label in self.menu_specs:
underline, label = prepstr(label) underline, label = prepstr(label)
menudict[name] = menu = Menu(mbar, name=name, tearoff=0) postcommand = getattr(self, f'{name}_menu_postcommand', None)
menudict[name] = menu = Menu(mbar, name=name, tearoff=0,
postcommand=postcommand)
mbar.add_cascade(label=label, menu=menu, underline=underline) mbar.add_cascade(label=label, menu=menu, underline=underline)
if macosx.isCarbonTk(): if macosx.isCarbonTk():
# Insert the application menu # Insert the application menu

View File

@ -990,6 +990,10 @@ class PyShell(OutputWindow):
self.showprompt() self.showprompt()
self.set_debugger_indicator() self.set_debugger_indicator()
def debug_menu_postcommand(self):
state = 'disabled' if self.executing else 'normal'
self.update_menu_state('debug', '*Stack Viewer', state)
def beginexecuting(self): def beginexecuting(self):
"Helper for ModifiedInterpreter" "Helper for ModifiedInterpreter"
self.resetoutput() self.resetoutput()

View File

@ -0,0 +1,2 @@
The "Stack Viewer" item in the "Debug" menu can no longer be selected when
user code is running.