MyFrontWindow = Win.FrontWindow
-try:
- import Wthreading
-except ImportError:
- haveThreading = 0
-else:
- haveThreading = Wthreading.haveThreading
-
_scriptuntitledcounter = 1
_wordchars = string.ascii_letters + string.digits + "_"
else:
cwdindex = None
try:
- if haveThreading:
- self._thread = Wthreading.Thread(os.path.basename(file),
- 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)
+ execstring(pytext, globals, locals, file, self.debugging,
+ modname, self.profiling)
finally:
if self.path:
os.chdir(savedir)
return
try:
if debugging:
- if haveThreading:
- lock = Wthreading.Lock()
- lock.acquire()
- PyDebugger.startfromhere()
- lock.release()
- else:
- PyDebugger.startfromhere()
- elif not haveThreading:
+ PyDebugger.startfromhere()
+ else:
if hasattr(MacOS, 'EnableAppswitch'):
MacOS.EnableAppswitch(0)
try:
else:
exec code in globals, locals
finally:
- if not haveThreading:
- if hasattr(MacOS, 'EnableAppswitch'):
- MacOS.EnableAppswitch(-1)
+ if hasattr(MacOS, 'EnableAppswitch'):
+ MacOS.EnableAppswitch(-1)
except W.AlertError, detail:
raise W.AlertError, detail
except (KeyboardInterrupt, BdbQuit):
if arg.code:
sys.stderr.write("Script exited with status code: %s\n" % repr(arg.code))
except:
- if haveThreading:
- import continuation
- lock = Wthreading.Lock()
- lock.acquire()
if debugging:
sys.settrace(None)
PyDebugger.postmortem(sys.exc_type, sys.exc_value, sys.exc_traceback)
return
else:
tracebackwindow.traceback(1, filename)
- if haveThreading:
- lock.release()
if debugging:
sys.settrace(None)
PyDebugger.stop()