From 012083666957a56e331d15eb1104366d83f1b9c4 Mon Sep 17 00:00:00 2001 From: "Vgr E. Barry" Date: Wed, 2 Nov 2016 14:52:30 -0400 Subject: [PATCH] Don't bother using a channel state in __del__ If the channel is being deleted, we don't need to care about the state. Furthermore, if the channel is being deleted as Python is shutting down, _States will have been deleted (or set to None), so we can't access it. Rather than trying to work around the garbage collection, we just set it to None and call it a day. --- src/channels.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/channels.py b/src/channels.py index 2ec59fb..ad765e8 100644 --- a/src/channels.py +++ b/src/channels.py @@ -17,7 +17,6 @@ class _States(Enum): PendingLeave = "pending leave" Left = "left channel" - Deleted = "deleted" Cleared = "cleared" # This is used to tell if this is a fake channel or not. If this @@ -71,7 +70,7 @@ class Channel(IRCContext): def __del__(self): self.users.clear() self.modes.clear() - self.state = _States.Deleted + self.state = None self.client = None self.timestamp = None