Commits

Maciej Fijalkowski committed bdb71d6

test and fix the repr of stuff with no args and a descr

Comments (0)

Files changed (2)

pypy/jit/metainterp/logger.py

                 r = "<Guard%d>" % index
             else:
                 r = self.repr_of_descr(descr)
-            args += ', descr=' +  r
+            if args:
+                args += ', descr=' +  r
+            else:
+                args = "descr=" + r
         if is_guard and op.getfailargs() is not None:
             fail_args = ' [' + ", ".join([self.repr_of_arg(arg)
                                           for arg in op.getfailargs()]) + ']'

pypy/jit/metainterp/test/test_logger.py

         '''
         self.reparse(inp)
 
+    def test_guard_not_invalidated(self):
+        inp = '''
+        []
+        guard_not_invalidated(descr=descr) []
+        finish()
+        '''
+        loop = pure_parse(inp, namespace={'descr': Descr()})
+        logger = Logger(self.make_metainterp_sd())
+        output = logger.log_loop(loop, {'descr': Descr()})
+        assert 'guard_not_invalidated(descr=' in output
+
     def test_guard_w_hole(self):
         inp = '''
         [i0]