mirror of
https://github.com/Klipper3d/klipper.git
synced 2025-11-02 19:36:04 +01:00
gcode_macro: fix reference issues to the variables attribute (#4925)
Create a copy of the dictionary prior to updating the the variable field. This fixes an issue where webhooks holds a reference to the variables dict returned by get_status(). Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
@@ -171,7 +171,9 @@ class GCodeMacro:
|
|||||||
literal = ast.literal_eval(value)
|
literal = ast.literal_eval(value)
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
raise gcmd.error("Unable to parse '%s' as a literal" % (value,))
|
raise gcmd.error("Unable to parse '%s' as a literal" % (value,))
|
||||||
self.variables[variable] = literal
|
v = dict(self.variables)
|
||||||
|
v[variable] = literal
|
||||||
|
self.variables = v
|
||||||
def cmd(self, gcmd):
|
def cmd(self, gcmd):
|
||||||
if self.in_script:
|
if self.in_script:
|
||||||
raise gcmd.error("Macro %s called recursively" % (self.alias,))
|
raise gcmd.error("Macro %s called recursively" % (self.alias,))
|
||||||
|
|||||||
Reference in New Issue
Block a user