From 023a985bfc8a627b1e4ccff797fbc33e3d064d6c Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Thu, 14 Jan 2021 22:13:50 -0500 Subject: gcode_macro: Use deepcopy() on get_status() results If a get_status() method returns a mutable object (such as a list or dict) then it would be possible for a gcode command template to incorrectly alter the program's internal state. Perform a deepcopy() operation on all get_status() return results to avoid that. Signed-off-by: Kevin O'Connor --- klippy/extras/query_endstops.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'klippy/extras/query_endstops.py') diff --git a/klippy/extras/query_endstops.py b/klippy/extras/query_endstops.py index 0bbb11c2..949e1585 100644 --- a/klippy/extras/query_endstops.py +++ b/klippy/extras/query_endstops.py @@ -8,7 +8,7 @@ class QueryEndstops: def __init__(self, config): self.printer = config.get_printer() self.endstops = [] - self.last_state = {} + self.last_state = [] # Register webhook if server is available webhooks = self.printer.lookup_object('webhooks') webhooks.register_endpoint( -- cgit v1.2.3-70-g09d2