This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author terry.reedy
Recipients THRlWiTi, markroseman, python-dev, sanad, terry.reedy
Date 2015-11-21.01:38:40
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1448069922.5.0.493290195527.issue24455@psf.upfronthosting.co.za>
In-reply-to
Content
Patch does two things.  On startup, check if debugger is already active and if it is, send 'finish' signal to existing interaction and try again after .1 second. This is the part aimed at the particular problem of this issue.

During active running, use the tcl vwait mechanism https://www.tcl.tk/man/tcl/TclCmd/vwait.htm intended for suspending and resuming a function without blocking the event loop.  Using root.mainloop and root.quit for this purpose was a hack that sort of worked but created the shutdown problems in #15347 and #15348.

To further explain the suspend/resume ping-ponging of control: IDLE's bebugger is based on the bdb.Bdb debug engine.  User interaction is added by overriding Bdb.user_xyz methods.  The overrides tell Bdb what to do after they return by calling Bdb.set_uvw methods.  idlelib.Debugger.Idb defines .user_line and .user_exception, which are called when the debugger stops on a line or with an exception.  Both end by calling Debugger.Debugger.interaction.  This method updates the gui and activates the buttons.  It must then pause (now with vwait waitvar) and allow button presses (and other IDLE gui events) to be handled *without* returning.  (The stdlib pdb can instead just call "cmd = input('pdb>')" and block waiting for user input.) When a debugger button is pressed, a Bdb.set_uvw method is called and waitvar is set.  Then .interaction resumes, disables the buttons, and returns so Bdb can do the action requested.  Thanks Mark for working this out and finding the proper pause/resume method.

On my Windows 10 machine, at least, the patch did not completely solve the hang-on-close issues.  One or two exceptions are raised instead of hanging. This is improvement. Details are on #15348.  Pending a better solution, I added try-except around the gui.interaction call to ignore the exception.

After numerous tests (at least 10) where I started and either stopped the debugger or restarted from the editor, I encountered a hang. But this was not something I could reproduce, and Restart Shell worked, whereas it had not previously.
History
Date User Action Args
2015-11-21 01:38:42terry.reedysetrecipients: + terry.reedy, markroseman, THRlWiTi, python-dev, sanad
2015-11-21 01:38:42terry.reedysetmessageid: <1448069922.5.0.493290195527.issue24455@psf.upfronthosting.co.za>
2015-11-21 01:38:42terry.reedylinkissue24455 messages
2015-11-21 01:38:40terry.reedycreate