From c27057e07a6af7f4126f39ba5f94e37928675278 Mon Sep 17 00:00:00 2001 From: Victor Poughon Date: Wed, 19 Apr 2023 15:58:25 +0200 Subject: [PATCH] merge lists without duplicates in merge_data --- sphinx_needs/needs.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sphinx_needs/needs.py b/sphinx_needs/needs.py index 433f4f520..a7ffa096b 100644 --- a/sphinx_needs/needs.py +++ b/sphinx_needs/needs.py @@ -739,11 +739,11 @@ def merge(name: str, is_complex_dict: bool = False) -> None: for other_key, other_value in other_objects.items(): # other_value is a list from here on! if other_key in objects: - objects[other_key] += other_value + objects[other_key] = list(set(objects[other_key]) | set(other_value)) else: objects[other_key] = other_value elif isinstance(other_objects, list) and isinstance(objects, list): - objects += other_objects + objects = list(set(objects) | set(other_objects)) else: raise TypeError( f'Objects to "merge" must be dict or list, ' f"not {type(other_objects)} and {type(objects)}"