aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/extras/heaters.py
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2021-01-14 22:13:50 -0500
committerKevin O'Connor <kevin@koconnor.net>2021-01-20 16:25:25 -0500
commit023a985bfc8a627b1e4ccff797fbc33e3d064d6c (patch)
tree744d4a41bcd50c4dd4514e7ce27e938cfecd6fce /klippy/extras/heaters.py
parent5b9beb52f6b417beb619c00b6b92ada6aabd32a8 (diff)
downloadkutter-023a985bfc8a627b1e4ccff797fbc33e3d064d6c.tar.gz
kutter-023a985bfc8a627b1e4ccff797fbc33e3d064d6c.tar.xz
kutter-023a985bfc8a627b1e4ccff797fbc33e3d064d6c.zip
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 <kevin@koconnor.net>
Diffstat (limited to 'klippy/extras/heaters.py')
-rw-r--r--klippy/extras/heaters.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/klippy/extras/heaters.py b/klippy/extras/heaters.py
index 829e9759..92d56db9 100644
--- a/klippy/extras/heaters.py
+++ b/klippy/extras/heaters.py
@@ -284,8 +284,8 @@ class PrinterHeaters:
"G-Code sensor id %s already registered" % (gcode_id,))
self.gcode_id_to_sensor[gcode_id] = psensor
def get_status(self, eventtime):
- return {'available_heaters': list(self.available_heaters),
- 'available_sensors': list(self.available_sensors)}
+ return {'available_heaters': self.available_heaters,
+ 'available_sensors': self.available_sensors}
def turn_off_all_heaters(self, print_time=0.):
for heater in self.heaters.values():
heater.set_temp(0.)