[pypy-svn] r57985 - pypy/branch/pypy-pytrunk/pypy/tool/pytest

pedronis at codespeak.net pedronis at codespeak.net
Mon Sep 8 18:41:43 CEST 2008


Author: pedronis
Date: Mon Sep  8 18:41:42 2008
New Revision: 57985

Modified:
   pypy/branch/pypy-pytrunk/pypy/tool/pytest/appsupport.py
Log:
(iko, pedronis)

stab at getargs for AppFrames



Modified: pypy/branch/pypy-pytrunk/pypy/tool/pytest/appsupport.py
==============================================================================
--- pypy/branch/pypy-pytrunk/pypy/tool/pytest/appsupport.py	(original)
+++ pypy/branch/pypy-pytrunk/pypy/tool/pytest/appsupport.py	Mon Sep  8 18:41:42 2008
@@ -10,8 +10,8 @@
 
 class AppCode(object):
     def __init__(self, space, pycode):
-        self.code = space.unwrap(space.getattr(pycode, space.wrap('co_code')))
-        self.raw = self.code
+        self.code = pycode
+        self.raw = pycode
         self.w_file = space.getattr(pycode, space.wrap('co_filename'))
         self.name = space.getattr(pycode, space.wrap('co_name'))
         self.firstlineno = space.unwrap(space.getattr(pycode, space.wrap('co_firstlineno')))
@@ -30,8 +30,7 @@
     fullsource = property(fullsource, None, None, "Full source of AppCode")
 
     def getargs(self):
-        # xxx WIP
-        return []
+        return self.raw.co_varnames[:self.raw.co_argcount]
 
 class AppFrame(py.code.Frame):
 
@@ -64,6 +63,15 @@
     def is_true(self, w_value):
         return self.space.is_true(w_value)
 
+    def getargs(self):
+        space = self.space
+        retval = []
+        for arg in self.code.getargs():
+            w_val = space.getitem(self.w_locals, space.wrap(arg))
+            retval.append((arg, w_val))
+        return retval
+
+
 class AppExceptionInfo(py.code.ExceptionInfo):
     """An ExceptionInfo object representing an app-level exception."""
 



More information about the Pypy-commit mailing list