mirror of https://github.com/Desuuuu/klipper.git
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:
parent
68c92991ed
commit
46381e03a4
|
@ -171,7 +171,9 @@ class GCodeMacro:
|
|||
literal = ast.literal_eval(value)
|
||||
except ValueError as e:
|
||||
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):
|
||||
if self.in_script:
|
||||
raise gcmd.error("Macro %s called recursively" % (self.alias,))
|
||||
|
|
Loading…
Reference in New Issue