stop possibility of infinite recursion in stages which
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Wed, 11 May 2022 10:17:16 +0000 (11:17 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Wed, 11 May 2022 10:17:19 +0000 (11:17 +0100)
set "stage = self"

src/nmutil/stageapi.py

index 01fc568b0146d2502321441619a667438d1aaa7a..a34dc7e213e784c1f1d5518e62400ce2956618fa 100644 (file)
@@ -197,7 +197,8 @@ class StageHelper(Stage):
 
     def setup(self, m, i):
         if self.stage is not None and hasattr(self.stage, "setup"):
-            self.stage.setup(m, i)
+            if self.stage is not self: # stop infinite recursion
+                self.stage.setup(m, i)
 
     def _postprocess(self, i):  # XXX DISABLED
         return i  # RETURNS INPUT