Armin Rigo committed bfb3a4f

A hard-to-test case: an assert which may actually fail

  • Participants
  • Parent commits ca1b566

Comments (0)

Files changed (1)

File rpython/jit/metainterp/

         num_green_args = self.jitdriver_sd.num_green_args
         greenkey = original_boxes[:num_green_args]
         if not self.partial_trace:
-            assert self.get_procedure_token(greenkey) is None or \
-                   self.get_procedure_token(greenkey).target_tokens is None
+            ptoken = self.get_procedure_token(greenkey)
+            if ptoken is not None and ptoken.target_tokens is not None:
+                # XXX this path not tested, but shown to occur on pypy-c :-(
+                self.staticdata.log('cancelled: we already have a token now')
+                raise SwitchToBlackhole(Counters.ABORT_BAD_LOOP)
         if self.partial_trace:
             target_token = compile.compile_retrace(self, greenkey, start,