From 2a964c44d4c84f65d55d3ab581d8e885da9ea8f0 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Mon, 3 Jun 2024 18:26:36 +1000 Subject: [PATCH] autotest: copy message hooks while iterating over them for removal won't remove a number of entries from the end of the list if others have been removed --- Tools/autotest/vehicle_test_suite.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tools/autotest/vehicle_test_suite.py b/Tools/autotest/vehicle_test_suite.py index 9d03c0c5d3c1e..ae1684d6f007f 100644 --- a/Tools/autotest/vehicle_test_suite.py +++ b/Tools/autotest/vehicle_test_suite.py @@ -8456,7 +8456,7 @@ def run_one_test_attempt(self, test, interact=False, attempt=1, suppress_stdout= ex = e # reset the message hooks; we've failed-via-exception and # can't expect the hooks to have been cleaned up - for h in self.mav.message_hooks: + for h in copy.copy(self.mav.message_hooks): if h not in start_message_hooks: self.mav.message_hooks.remove(h) hooks_removed = True