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.
This commit is contained in:
Vgr E. Barry 2016-11-02 14:52:30 -04:00
parent b4fc7ac82d
commit 0120836669

View File

@ -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