diff --git a/evennia/commands/cmdhandler.py b/evennia/commands/cmdhandler.py index 8b93d6689d..5b7caf0cfe 100644 --- a/evennia/commands/cmdhandler.py +++ b/evennia/commands/cmdhandler.py @@ -32,7 +32,6 @@ from collections import defaultdict from copy import copy from itertools import chain from traceback import format_exc -from weakref import WeakValueDictionary from django.conf import settings from django.utils.translation import gettext as _ @@ -49,7 +48,7 @@ _IN_GAME_ERRORS = settings.IN_GAME_ERRORS __all__ = ("cmdhandler", "InterruptCommand") _GA = object.__getattribute__ -_CMDSET_MERGE_CACHE = WeakValueDictionary() +_CMDSET_MERGE_CACHE = {} # tracks recursive calls by each caller # to avoid infinite loops (commands calling themselves) diff --git a/evennia/commands/cmdset.py b/evennia/commands/cmdset.py index cac54816cb..12505bf5c1 100644 --- a/evennia/commands/cmdset.py +++ b/evennia/commands/cmdset.py @@ -248,7 +248,8 @@ class CmdSet(object, metaclass=_CmdSetMeta): if cmdset_a.duplicates and cmdset_a.priority == cmdset_b.priority: cmdset_c.commands.extend(cmdset_b.commands) else: - cmdset_c.commands.extend([cmd for cmd in cmdset_b if cmd not in cmdset_a]) + existing_commands = set(cmdset_a.commands) + cmdset_c.commands.extend([cmd for cmd in cmdset_b if cmd not in existing_commands]) return cmdset_c def _intersect(self, cmdset_a, cmdset_b):