From d60c9f222b34a847c96a3394b518fcaac6922b29 Mon Sep 17 00:00:00 2001 From: Rossen Georgiev Date: Sun, 28 Feb 2016 13:29:56 +0000 Subject: [PATCH] fix reset_attribute sometimes raising AttributeError --- steam/core/cm.py | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/steam/core/cm.py b/steam/core/cm.py index feb3460..d53ff02 100644 --- a/steam/core/cm.py +++ b/steam/core/cm.py @@ -116,19 +116,18 @@ class CMClient(EventEmitter): self.emit('disconnected') def _reset_attributes(self): - del self.current_server_addr - del self.connected - del self.channel_secured - - del self.key - del self.hmac_secret - - del self.steam_id - del self.session_id - del self.webapi_authenticate_user_nonce - - del self._recv_loop - del self._heartbeat_loop + for name in ['current_server_addr', + 'connected', + 'channel_secured', + 'key', + 'hmac_secret', + 'steam_id', + 'session_id', + 'webapi_authenticate_user_nonce', + '_recv_loop', + '_heartbeat_loop', + ]: + self.__dict__.pop(name, None) def send_message(self, message): """