[Idle-dev] CVS: idle PyShell.py,1.71,1.72 config-main.def,1.17,1.18 run.py,1.19,1.20
Kurt B. Kaiser
kbk@users.sourceforge.net
Tue, 27 May 2003 18:47:49 -0700
Update of /cvsroot/idlefork/idle
In directory sc8-pr-cvs1:/tmp/cvs-serv2014
Modified Files:
PyShell.py config-main.def run.py
Log Message:
Added a config-main General option to delete sys.exitfunc. The default
is not to do that. VPython and student environment support.
M PyShell.py
M config-main.def
M run.py
Index: PyShell.py
===================================================================
RCS file: /cvsroot/idlefork/idle/PyShell.py,v
retrieving revision 1.71
retrieving revision 1.72
diff -C2 -r1.71 -r1.72
*** PyShell.py 26 May 2003 22:20:32 -0000 1.71
--- PyShell.py 28 May 2003 01:47:46 -0000 1.72
***************
*** 313,316 ****
--- 313,317 ----
self.save_warnings_filters = None
self.restarting = False
+ self.subprocess_arglist = self.build_subprocess_arglist()
port = 8833
***************
*** 319,323 ****
def spawn_subprocess(self):
! args = self.build_subprocess_arglist()
self.rpcpid = os.spawnv(os.P_NOWAIT, args[0], args)
--- 320,324 ----
def spawn_subprocess(self):
! args = self.subprocess_arglist
self.rpcpid = os.spawnv(os.P_NOWAIT, args[0], args)
***************
*** 327,334 ****
# or maybe it's not installed and the idle.py script is being
# run from the IDLE source directory.
if __name__ == 'idlelib.PyShell':
! command = "__import__('idlelib.run').run.main()"
else:
! command = "__import__('run').main()"
return [sys.executable] + w + ["-c", command, str(self.port)]
--- 328,337 ----
# or maybe it's not installed and the idle.py script is being
# run from the IDLE source directory.
+ del_exitf = idleConf.GetOption('main', 'General', 'delete-exitfunc',
+ default=False, type='bool')
if __name__ == 'idlelib.PyShell':
! command = "__import__('idlelib.run').run.main(" + `del_exitf` +")"
else:
! command = "__import__('run').main(" + `del_exitf` + ")"
return [sys.executable] + w + ["-c", command, str(self.port)]
Index: config-main.def
===================================================================
RCS file: /cvsroot/idlefork/idle/config-main.def,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -r1.17 -r1.18
*** config-main.def 26 May 2003 20:35:53 -0000 1.17
--- config-main.def 28 May 2003 01:47:46 -0000 1.18
***************
*** 44,47 ****
--- 44,48 ----
print-command-posix=lpr %s
print-command-win=start /min notepad /p %s
+ delete-exitfunc= 0
[EditorWindow]
Index: run.py
===================================================================
RCS file: /cvsroot/idlefork/idle/run.py,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -r1.19 -r1.20
*** run.py 24 May 2003 20:59:15 -0000 1.19
--- run.py 28 May 2003 01:47:46 -0000 1.20
***************
*** 25,29 ****
quitting = False
! def main():
"""Start the Python execution server in a subprocess
--- 25,29 ----
quitting = False
! def main(del_exitfunc=False):
"""Start the Python execution server in a subprocess
***************
*** 45,48 ****
--- 45,50 ----
global exit_now
global quitting
+ global no_exitfunc
+ no_exitfunc = del_exitfunc
port = 8833
if sys.argv[1:]:
***************
*** 58,62 ****
if exit_now:
try:
! sys.exit(0)
except KeyboardInterrupt:
# exiting but got an extra KBI? Try again!
--- 60,64 ----
if exit_now:
try:
! exit()
except KeyboardInterrupt:
# exiting but got an extra KBI? Try again!
***************
*** 84,88 ****
# Link didn't work, print same exception to __stderr__
traceback.print_exception(type, value, tb, file=sys.__stderr__)
! sys.exit(0)
else:
continue
--- 86,90 ----
# Link didn't work, print same exception to __stderr__
traceback.print_exception(type, value, tb, file=sys.__stderr__)
! exit()
else:
continue
***************
*** 160,163 ****
--- 162,175 ----
pass
+ def exit():
+ """Exit subprocess, possibly after first deleting sys.exitfunc
+
+ If config-main.cfg/.def 'General' 'delete-exitfunc' is True, then any
+ sys.exitfunc will be removed before exiting. (VPython support)
+
+ """
+ if no_exitfunc:
+ del sys.exitfunc
+ sys.exit(0)
class MyRPCServer(rpc.RPCServer):
***************
*** 187,191 ****
print>>erf, '\n*** Unrecoverable, server exiting!'
print>>erf, '-'*40
! sys.exit(0)
--- 199,203 ----
print>>erf, '\n*** Unrecoverable, server exiting!'
print>>erf, '-'*40
! exit()
***************
*** 230,234 ****
except:
if quitting:
! sys.exit(0)
# even print a user code SystemExit exception, continue
print_exception()
--- 242,246 ----
except:
if quitting:
! exit()
# even print a user code SystemExit exception, continue
print_exception()