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:
parent
b4fc7ac82d
commit
0120836669
@ -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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user