From a94866a20bf4757d7b6473e64185fdd7ad168af0 Mon Sep 17 00:00:00 2001 From: hpk Date: Tue, 7 Aug 2007 19:54:09 +0200 Subject: [PATCH] [svn r45541] don't use globals when we might be called from destructors --HG-- branch : trunk --- py/execnet/gateway.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/py/execnet/gateway.py b/py/execnet/gateway.py index 0c1c757af..f181c5913 100644 --- a/py/execnet/gateway.py +++ b/py/execnet/gateway.py @@ -24,13 +24,14 @@ if 'ThreadOut' not in globals(): ThreadOut = py._thread.ThreadOut import os -debug = open('/tmp/execnet-debug-%d' % os.getpid() , 'wa') +debug = 0 # open('/tmp/execnet-debug-%d' % os.getpid() , 'wa') sysex = (KeyboardInterrupt, SystemExit) class StopExecLoop(Exception): pass class Gateway(object): + _StopExecLoop = StopExecLoop _ThreadOut = ThreadOut remoteaddress = "" _requestqueue = None @@ -165,7 +166,7 @@ class Gateway(object): break try: self._executetask(item) - except StopExecLoop: + except self._StopExecLoop: break finally: self._trace("_servemain finished") @@ -189,7 +190,7 @@ class Gateway(object): gw._stopsend() execpool.shutdown() execpool.join() - raise StopExecLoop + raise gw._StopExecLoop execpool.dispatch(gw._executetask, task) """ % num) self._remotechannelthread = self.remote_exec(source) @@ -211,7 +212,7 @@ class Gateway(object): self._trace("execution finished:", repr(source)[:50]) except (KeyboardInterrupt, SystemExit): pass - except StopExecLoop: + except self._StopExecLoop: channel.close() raise except: