[Python-checkins] r58396 - python/trunk/Lib/idlelib/NEWS.txt python/trunk/Lib/idlelib/run.py
kurt.kaiser
python-checkins at python.org
Tue Oct 9 21:31:31 CEST 2007
Author: kurt.kaiser
Date: Tue Oct 9 21:31:30 2007
New Revision: 58396
Modified:
python/trunk/Lib/idlelib/NEWS.txt
python/trunk/Lib/idlelib/run.py
Log:
Allow interrupt only when executing user code in subprocess
Patch 1225 Tal Einat modified from IDLE-Spoon.
Modified: python/trunk/Lib/idlelib/NEWS.txt
==============================================================================
--- python/trunk/Lib/idlelib/NEWS.txt (original)
+++ python/trunk/Lib/idlelib/NEWS.txt Tue Oct 9 21:31:30 2007
@@ -3,6 +3,9 @@
*Release date: XX-XXX-200X*
+- Allow keyboard interrupt only when user code is executing in subprocess.
+ Patch 1225 Tal Einat (reworked from IDLE-Spoon).
+
- configDialog cleanup. Patch 1730217 Tal Einat.
- textView cleanup. Patch 1718043 Tal Einat.
Modified: python/trunk/Lib/idlelib/run.py
==============================================================================
--- python/trunk/Lib/idlelib/run.py (original)
+++ python/trunk/Lib/idlelib/run.py Tue Oct 9 21:31:30 2007
@@ -38,10 +38,11 @@
# Thread shared globals: Establish a queue between a subthread (which handles
# the socket) and the main thread (which runs user code), plus global
-# completion and exit flags:
+# completion, exit and interruptable (the main thread) flags:
exit_now = False
quitting = False
+interruptable = False
def main(del_exitfunc=False):
"""Start the Python execution server in a subprocess
@@ -280,9 +281,14 @@
self.autocomplete = AutoComplete.AutoComplete()
def runcode(self, code):
+ global interruptable
try:
self.usr_exc_info = None
- exec code in self.locals
+ interruptable = True
+ try:
+ exec code in self.locals
+ finally:
+ interruptable = False
except:
self.usr_exc_info = sys.exc_info()
if quitting:
@@ -296,7 +302,8 @@
flush_stdout()
def interrupt_the_server(self):
- thread.interrupt_main()
+ if interruptable:
+ thread.interrupt_main()
def start_the_debugger(self, gui_adap_oid):
return RemoteDebugger.start_debugger(self.rpchandler, gui_adap_oid)
More information about the Python-checkins
mailing list