Commits

Ronan Lamy committed 9f4d8f5

remove nextra argument from rawshape()

Comments (0)

Files changed (3)

rpython/annotator/argument.py

             data_w.append(self.w_stararg)
         return (shape_cnt, shape_keys, shape_star), data_w
 
-    def _rawshape(self, nextra=0):
-        shape_cnt = len(self.arguments_w) + nextra  # Number of positional args
+    def _rawshape(self):
+        shape_cnt = len(self.arguments_w)
         shape_keys = tuple(sorted(self.keywords))
         shape_star = self.w_stararg is not None   # Flag: presence of *arg
         return shape_cnt, shape_keys, shape_star
 
 
-def rawshape(args, nextra=0):
-    return args._rawshape(nextra)
+def rawshape(args):
+    return args._rawshape()
 
 
 #

rpython/annotator/description.py

                                              self.name,
                                              flags)
 
+    @staticmethod
     def consider_call_site(bookkeeper, family, descs, args, s_result, op):
-        shape = rawshape(args, nextra=1)     # account for the extra 'self'
+        cnt, keys, star = rawshape(args)
+        shape = cnt + 1, keys, star  # account for the extra 'self'
         row = FunctionDesc.row_to_consider(descs, args, op)
         family.calltable_add_row(shape, row)
-    consider_call_site = staticmethod(consider_call_site)
 
     def rowkey(self):
         # we are computing call families and call tables that always contain
         args = args.prepend(s_self)
         return self.funcdesc.pycall(schedule, args, s_previous_result, op)
 
+    @staticmethod
     def consider_call_site(bookkeeper, family, descs, args, s_result, op):
-        shape = rawshape(args, nextra=1)    # account for the extra 'self'
+        cnt, keys, star = rawshape(args)
+        shape = cnt + 1, keys, star  # account for the extra 'self'
         row = FunctionDesc.row_to_consider(descs, args, op)
         family.calltable_add_row(shape, row)
-    consider_call_site = staticmethod(consider_call_site)
 
     def rowkey(self):
         return self.funcdesc

rpython/annotator/test/test_argument.py

         args = MockArgs([1, 2, 3])
         assert rawshape(args) == (3, (), False)
 
-        args = MockArgs([1])
-        assert rawshape(args, 2) == (3, (), False)
-
         args = MockArgs([1, 2, 3, 4, 5])
         assert rawshape(args) == (5, (), False)