From 92b9356ed2639068dfb552ea25f79a8e50037393 Mon Sep 17 00:00:00 2001 From: Philipp Maier Date: Fri, 21 Jul 2023 11:38:26 +0200 Subject: [PATCH] runtime: fix lchan deletion in method reset When we perform a reset while multiple channels are open (this is in particular the case when parsing real world traces with pySim-trace). To delete those channels during the reset we iterate over the dictionary using the keys and delete the channels one by one. However, this must not be done using the keys as index directly. Python will then throw an exception: "RuntimeError: dictionary changed size during iteration". Instead using the keys directly we should cast them into a list and then using that list for the iteration. Related: OS#6094 Change-Id: I430ef216cf847ffbde2809f492ee9ed9030343b6 --- pySim/runtime.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pySim/runtime.py b/pySim/runtime.py index 5d181e84..642e9c19 100644 --- a/pySim/runtime.py +++ b/pySim/runtime.py @@ -124,7 +124,7 @@ class RuntimeState: cmd_app : Command Application State (for unregistering old file commands) """ # delete all lchan != 0 (basic lchan) - for lchan_nr in self.lchan.keys(): + for lchan_nr in list(self.lchan.keys()): if lchan_nr == 0: continue del self.lchan[lchan_nr]