diff --git a/py/execnet/gateway.py b/py/execnet/gateway.py index 57c089683..6a23c0d24 100644 --- a/py/execnet/gateway.py +++ b/py/execnet/gateway.py @@ -167,7 +167,8 @@ class Gateway(object): except IOError: self._trace('IOError on _stopsend()') self._channelfactory._finished_receiving() - self._trace('leaving %r' % threading.currentThread()) + if threading: # might be None during shutdown/finalization + self._trace('leaving %r' % threading.currentThread()) from sys import exc_info def _send(self, msg):