dead code removal

This commit is contained in:
Just van Rossum 2003-05-09 08:27:33 +00:00
parent 28e9ce9df2
commit 5ef0e7cc47

View file

@ -26,13 +26,6 @@ else:
MyFrontWindow = Win.FrontWindow MyFrontWindow = Win.FrontWindow
try:
import Wthreading
except ImportError:
haveThreading = 0
else:
haveThreading = Wthreading.haveThreading
_scriptuntitledcounter = 1 _scriptuntitledcounter = 1
_wordchars = string.ascii_letters + string.digits + "_" _wordchars = string.ascii_letters + string.digits + "_"
@ -659,15 +652,8 @@ class Editor(W.Window):
else: else:
cwdindex = None cwdindex = None
try: try:
if haveThreading: execstring(pytext, globals, locals, file, self.debugging,
self._thread = Wthreading.Thread(os.path.basename(file), modname, self.profiling)
self._exec_threadwrapper, pytext, globals, locals, file, self.debugging,
modname, self.profiling)
self.setthreadstate((1, 1))
self._thread.start()
else:
execstring(pytext, globals, locals, file, self.debugging,
modname, self.profiling)
finally: finally:
if self.path: if self.path:
os.chdir(savedir) os.chdir(savedir)
@ -1204,14 +1190,8 @@ def execstring(pytext, globals, locals, filename="<string>", debugging=0,
return return
try: try:
if debugging: if debugging:
if haveThreading: PyDebugger.startfromhere()
lock = Wthreading.Lock() else:
lock.acquire()
PyDebugger.startfromhere()
lock.release()
else:
PyDebugger.startfromhere()
elif not haveThreading:
if hasattr(MacOS, 'EnableAppswitch'): if hasattr(MacOS, 'EnableAppswitch'):
MacOS.EnableAppswitch(0) MacOS.EnableAppswitch(0)
try: try:
@ -1229,9 +1209,8 @@ def execstring(pytext, globals, locals, filename="<string>", debugging=0,
else: else:
exec code in globals, locals exec code in globals, locals
finally: finally:
if not haveThreading: if hasattr(MacOS, 'EnableAppswitch'):
if hasattr(MacOS, 'EnableAppswitch'): MacOS.EnableAppswitch(-1)
MacOS.EnableAppswitch(-1)
except W.AlertError, detail: except W.AlertError, detail:
raise W.AlertError, detail raise W.AlertError, detail
except (KeyboardInterrupt, BdbQuit): except (KeyboardInterrupt, BdbQuit):
@ -1240,18 +1219,12 @@ def execstring(pytext, globals, locals, filename="<string>", debugging=0,
if arg.code: if arg.code:
sys.stderr.write("Script exited with status code: %s\n" % repr(arg.code)) sys.stderr.write("Script exited with status code: %s\n" % repr(arg.code))
except: except:
if haveThreading:
import continuation
lock = Wthreading.Lock()
lock.acquire()
if debugging: if debugging:
sys.settrace(None) sys.settrace(None)
PyDebugger.postmortem(sys.exc_type, sys.exc_value, sys.exc_traceback) PyDebugger.postmortem(sys.exc_type, sys.exc_value, sys.exc_traceback)
return return
else: else:
tracebackwindow.traceback(1, filename) tracebackwindow.traceback(1, filename)
if haveThreading:
lock.release()
if debugging: if debugging:
sys.settrace(None) sys.settrace(None)
PyDebugger.stop() PyDebugger.stop()