[pypy-svn] r14778 - in pypy/dist/pypy/interpreter: . test

hpk at codespeak.net hpk at codespeak.net
Tue Jul 19 17:54:25 CEST 2005


Author: hpk
Date: Tue Jul 19 17:54:19 2005
New Revision: 14778

Modified:
   pypy/dist/pypy/interpreter/pyframe.py
   pypy/dist/pypy/interpreter/test/test_pyframe.py
   pypy/dist/pypy/interpreter/typedef.py
Log:
- allow 'del frame.f_trace', should fix some compliance tests

- unindent a test and note that it doesn't really test much



Modified: pypy/dist/pypy/interpreter/pyframe.py
==============================================================================
--- pypy/dist/pypy/interpreter/pyframe.py	(original)
+++ pypy/dist/pypy/interpreter/pyframe.py	Tue Jul 19 17:54:19 2005
@@ -291,6 +291,9 @@
             self.w_f_trace = w_trace
             self.f_lineno = self.get_last_lineno()
 
+    def fdel_f_trace(space, self): 
+        self.w_f_trace = None 
+
     def fget_f_exc_type(space, self):
         if self.last_exception is not None:
             f = self.f_back

Modified: pypy/dist/pypy/interpreter/test/test_pyframe.py
==============================================================================
--- pypy/dist/pypy/interpreter/test/test_pyframe.py	(original)
+++ pypy/dist/pypy/interpreter/test/test_pyframe.py	Tue Jul 19 17:54:19 2005
@@ -27,6 +27,12 @@
             return f.f_code
         assert g() is g.func_code
 
+    def test_f_trace_del(self): 
+        import sys
+        f = sys._getframe() 
+        del f.f_trace 
+        assert f.f_trace is None
+
     def test_f_lineno(self):
         def g():
             import sys
@@ -39,18 +45,18 @@
         assert g() == [origin+3, origin+4, origin+5]
 
     def test_f_back(self):
-            import sys
-            def trace(a,b,c): return trace
-            def f():
-                f_frame = sys._getframe()
-                return g(f_frame)
-            def g(f_frame):
-                g_frame = sys._getframe()
-                print g_frame
-                print g_frame.f_back
-                print g_frame.f_back.f_code.co_name, f_frame.f_code.co_name 
-            sys.settrace(trace)
-            f()
+        import sys
+        def trace(a,b,c): return trace
+        def f():
+            f_frame = sys._getframe()
+            return g(f_frame)
+        def g(f_frame):
+            g_frame = sys._getframe()
+            print g_frame
+            print g_frame.f_back
+            print g_frame.f_back.f_code.co_name, f_frame.f_code.co_name 
+        sys.settrace(trace)
+        f() # XXX actually test something? 
 
     def test_f_exc_xxx(self):
         import sys

Modified: pypy/dist/pypy/interpreter/typedef.py
==============================================================================
--- pypy/dist/pypy/interpreter/typedef.py	(original)
+++ pypy/dist/pypy/interpreter/typedef.py	Tue Jul 19 17:54:19 2005
@@ -396,7 +396,8 @@
     f_lineno = GetSetProperty(PyFrame.fget_f_lineno, PyFrame.fset_f_lineno),
     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_trace = GetSetProperty(PyFrame.fget_f_trace, PyFrame.fset_f_trace, 
+                             PyFrame.fdel_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),



More information about the Pypy-commit mailing list