Skip to content

MLC120: Restore without save_state() on any path

qual reports MLC120 when Restore(mob) is constructed — or mob.restore() is called — and no execution path has called mob.save_state() beforehand. There is nothing to restore and Manim raises at render time.

  • Default severity: error
  • Minimum confidence: high
  • Implementation phase: 2
  • Fix: none

The verdict comes from the lifecycle abstract interpreter: Absent means absent on all paths; a state saved on only some paths (Maybe) stays silent, as does a scene whose constructor chain could not be resolved.

Wrong

class Demo(Scene):
    def construct(self):
        sq = Square()
        self.add(sq)
        self.play(Restore(sq))  # no save_state() anywhere
class Demo(Scene):
    def construct(self):
        sq = Square()
        self.add(sq)
        sq.save_state()
        self.play(sq.animate.shift(RIGHT))
        self.play(Restore(sq))