diff options
author | Eric Callahan <Arksine@users.noreply.github.com> | 2021-11-19 02:01:16 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-19 02:01:16 -0500 |
commit | 46381e03a4e27f5905aafafeabab077c9bdf7f33 (patch) | |
tree | 043b49130c1991c34c6a89f2299e10971ba9d4bb | |
parent | 68c92991eddf0a18328f3c81a6839ab0678a9521 (diff) | |
download | kutter-46381e03a4e27f5905aafafeabab077c9bdf7f33.tar.gz kutter-46381e03a4e27f5905aafafeabab077c9bdf7f33.tar.xz kutter-46381e03a4e27f5905aafafeabab077c9bdf7f33.zip |
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>
-rw-r--r-- | klippy/extras/gcode_macro.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/klippy/extras/gcode_macro.py b/klippy/extras/gcode_macro.py index 97584bdf..8d55db3b 100644 --- a/klippy/extras/gcode_macro.py +++ b/klippy/extras/gcode_macro.py @@ -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,)) |