Fix midgame joining in mael
copy/deepcopy didn't know what to do with user objects due to custom __new__. Since __new__ returns an existing user if possible anyway, just have copy/deepcopy return the same user instance that is being copied.
This commit is contained in:
parent
9eaaa90c8e
commit
a3839b25d6
@ -209,6 +209,15 @@ class User(IRCContext):
|
|||||||
|
|
||||||
is_user = True
|
is_user = True
|
||||||
|
|
||||||
|
# Things break a lot if user instances aren't unique for the same data set
|
||||||
|
# __new__ already returns an existing user instance if possible, but no need
|
||||||
|
# to run through that logic if we already know what instance is desired.
|
||||||
|
def __copy__(self):
|
||||||
|
return self
|
||||||
|
|
||||||
|
def __deepcopy__(self, memo):
|
||||||
|
return self
|
||||||
|
|
||||||
def __new__(cls, cli, nick, ident, host, realname, account):
|
def __new__(cls, cli, nick, ident, host, realname, account):
|
||||||
self = super().__new__(cls)
|
self = super().__new__(cls)
|
||||||
super(__class__, self).__init__(nick, cli)
|
super(__class__, self).__init__(nick, cli)
|
||||||
|
Loading…
Reference in New Issue
Block a user