[pypy-svn] r10179 - pypy/dist/pypy/interpreter

ac at codespeak.net ac at codespeak.net
Wed Mar 30 17:47:54 CEST 2005


Author: ac
Date: Wed Mar 30 17:47:54 2005
New Revision: 10179

Modified:
   pypy/dist/pypy/interpreter/pyframe.py
   pypy/dist/pypy/interpreter/typedef.py
Log:
Add f_exc_XXX and f.restricted to frame object.

Modified: pypy/dist/pypy/interpreter/pyframe.py
==============================================================================
--- pypy/dist/pypy/interpreter/pyframe.py	(original)
+++ pypy/dist/pypy/interpreter/pyframe.py	Wed Mar 30 17:47:54 2005
@@ -290,6 +290,41 @@
         else:
             self.w_f_trace = w_trace
             self.f_lineno = self.get_last_lineno()
+
+    def fget_f_exc_type(space, w_self):
+        self = space.interpclass_w(w_self)
+        if self.last_exception is not None:
+            f = self.f_back
+            while f is not None and f.last_exception is None:
+                f = f_back
+            if f is not None:
+                return f.last_exception.w_type
+        return space.w_None
+         
+    def fget_f_exc_value(space, w_self):
+        self = space.interpclass_w(w_self)
+        if self.last_exception is not None:
+            f = self.f_back
+            while f is not None and f.last_exception is None:
+                f = f_back
+            if f is not None:
+                return f.last_exception.w_value
+        return space.w_None
+
+    def fget_f_exc_traceback(space, w_self):
+        self = space.interpclass_w(w_self)
+        if self.last_exception is not None:
+            f = self.f_back
+            while f is not None and f.last_exception is None:
+                f = f_back
+            if f is not None:
+                return space.wrap(f.last_exception.application_traceback)
+        return space.w_None
+         
+    def fget_f_restricted(space, w_self):
+        self = space.interpclass_w(w_self)
+        return space.wrap(self.builtin is not space.builtin)
+
 ### Frame Blocks ###
 
 class FrameBlock:

Modified: pypy/dist/pypy/interpreter/typedef.py
==============================================================================
--- pypy/dist/pypy/interpreter/typedef.py	(original)
+++ pypy/dist/pypy/interpreter/typedef.py	Wed Mar 30 17:47:54 2005
@@ -336,6 +336,10 @@
     f_back = GetSetProperty(PyFrame.fget_f_back),
     f_lasti = GetSetProperty(PyFrame.fget_f_lasti),
     f_trace = GetSetProperty(PyFrame.fget_f_trace, PyFrame.fset_f_trace),
+    f_exc_type = GetSetProperty(PyFrame.fget_f_exc_type),
+    f_exc_value = GetSetProperty(PyFrame.fget_f_exc_value),
+    f_exc_traceback = GetSetProperty(PyFrame.fget_f_exc_traceback),
+    f_restricted = GetSetProperty(PyFrame.fget_f_restricted),
     **Frame.typedef.rawdict)
 
 Module.typedef = TypeDef("module",



More information about the Pypy-commit mailing list