From b2a54baaf583b3696b095b19b8ce851e1284de7f Mon Sep 17 00:00:00 2001 From: David Hendriks <davidhendriks93@gmail.com> Date: Fri, 8 Jan 2021 00:29:51 +0000 Subject: [PATCH] fixed bug. boolean has to be caught first, cause True is also seen as an int --- binarycpython/utils/functions.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/binarycpython/utils/functions.py b/binarycpython/utils/functions.py index 0dfdc51ad..72cf8c7a9 100644 --- a/binarycpython/utils/functions.py +++ b/binarycpython/utils/functions.py @@ -1136,7 +1136,11 @@ def merge_dicts(dict_1: dict, dict_2: dict) -> dict: # dealt with by calling this function again. else: # ints - if isinstance(dict_1[key], int) and isinstance(dict_2[key], int): + # Booleans (has to be the type Bool, not just a 0 or 1) + if isinstance(dict_1[key], bool) and isinstance(dict_2[key], bool): + new_dict[key] = dict_1[key] or dict_2[key] + + elif isinstance(dict_1[key], int) and isinstance(dict_2[key], int): new_dict[key] = dict_1[key] + dict_2[key] # floats @@ -1151,10 +1155,6 @@ def merge_dicts(dict_1: dict, dict_2: dict) -> dict: elif isinstance(dict_1[key], dict) and isinstance(dict_2[key], dict): new_dict[key] = merge_dicts(dict_1[key], dict_2[key]) - # Booleans (has to be the type Bool, not just a 0 or 1) - elif isinstance(dict_1[key], bool) and isinstance(dict_2[key], bool): - new_dict[key] = dict_1[key] or dict_2[key] - else: print( "Object types {},{} not supported".format( -- GitLab