From 7e95e2afc8200b82a352f6f5f0935286c1a0f352 Mon Sep 17 00:00:00 2001 From: Robey Pointer Date: Fri, 11 Nov 2005 17:43:01 +0000 Subject: [project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-79] in Transport.__del__, don't try to clean up attributes that were never created --- paramiko/transport.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/paramiko/transport.py b/paramiko/transport.py index 9609773e..32436f4a 100644 --- a/paramiko/transport.py +++ b/paramiko/transport.py @@ -502,9 +502,13 @@ class Transport (threading.Thread): Close this session, and any open channels that are tied to it. """ self.active = False - self.packetizer.close() - for chan in self.channels.values(): - chan._unlink() + # since this may be called from __del__, can't assume any attributes exist + try: + self.packetizer.close() + for chan in self.channels.values(): + chan._unlink() + except AttributeError: + pass def get_remote_server_key(self): """ @@ -1576,7 +1580,6 @@ class Transport (threading.Thread): # it's now okay to send data again (if this was a re-key) if not self.packetizer.need_rekey(): self.in_kex = False - self._log(DEBUG, 'clear to send') self.clear_to_send_lock.acquire() try: self.clear_to_send.set() -- cgit v1.2.3