From 9e6cfceaaca4c279432c7bc17d49d3ed354d6b8f Mon Sep 17 00:00:00 2001 From: Nathanael Sensfelder Date: Sat, 15 Aug 2020 17:53:35 +0200 Subject: set_value should copy values... --- tonkadur.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'tonkadur.py') diff --git a/tonkadur.py b/tonkadur.py index 8549847..8c0dee1 100644 --- a/tonkadur.py +++ b/tonkadur.py @@ -198,7 +198,6 @@ class Tonkadur: target = target[addr] # if (isinstance(target, list)): # print("That's a list.") - return target def resolve_choice_to (self, line): @@ -295,7 +294,13 @@ class Tonkadur: if (access in current_val): current_val = current_val[access] - pre_val[last_access] = self.compute(instruction["value"]) + + result = self.compute(instruction["value"]) + + if (isinstance(result, list) or isinstance(result, dict)): + result = copy.deepcopy(result) + + pre_val[last_access] = result self.program_counter += 1 -- cgit v1.2.3-70-g09d2