Commits

Manuel Jacob committed cbd3258

Fix pypy.tool.pytest.appsupport to work with new versions of pytest.

  • Participants
  • Parent commits 53b7cc7

Comments (0)

Files changed (1)

File pypy/tool/pytest/appsupport.py

+from inspect import CO_VARARGS, CO_VARKEYWORDS
+
 import py
 from pypy.interpreter import gateway, pycode
 from pypy.interpreter.error import OperationError
             return None
     fullsource = property(fullsource, None, None, "Full source of AppCode")
 
-    def getargs(self):
-        return self.raw.co_varnames[:self.raw.co_argcount]
+    def getargs(self, var=False):
+        raw = self.raw
+        argcount = raw.co_argcount
+        if var:
+            argcount += raw.co_flags & CO_VARARGS
+            argcount += raw.co_flags & CO_VARKEYWORDS
+        return raw.co_varnames[:argcount]
 
 class AppFrame(py.code.Frame):
 
     def is_true(self, w_value):
         return self.space.is_true(w_value)
 
-    def getargs(self):
+    def getargs(self, var=False):
         space = self.space
         retval = []
-        for arg in self.code.getargs():
+        for arg in self.code.getargs(var):
             w_val = space.finditem(self.w_locals, space.wrap(arg))
             if w_val is None:
                 w_val = space.wrap('<no value found>')