[ILibrary.add] respect mutate_other=False even without duplicate keys

This commit is contained in:
Jan Petykiewicz 2026-03-31 23:47:09 -07:00
commit f461222852
2 changed files with 18 additions and 2 deletions

View file

@ -926,8 +926,13 @@ class ILibrary(ILibraryView, MutableMapping[str, 'Pattern'], metaclass=ABCMeta):
duplicates = set(self.keys()) & set(other.keys())
if not duplicates:
for key in other:
self._merge(key, other, key)
if mutate_other:
temp = other
else:
temp = Library(copy.deepcopy(dict(other)))
for key in temp:
self._merge(key, temp, key)
return {}
if mutate_other: