mirror of
https://github.com/Klipper3d/klipper.git
synced 2025-07-09 07:56:26 -06:00
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>
This commit is contained in:
parent
5b9beb52f6
commit
023a985bfc
4 changed files with 8 additions and 9 deletions
|
@ -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.)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue