[pypy-svn] r5034 - in pypy/trunk/src/pypy: interpreter module/test

mwh at codespeak.net mwh at codespeak.net
Thu Jun 10 18:29:33 CEST 2004


Author: mwh
Date: Thu Jun 10 18:29:32 2004
New Revision: 5034

Modified:
   pypy/trunk/src/pypy/interpreter/pyframe.py
   pypy/trunk/src/pypy/module/test/test_sysmodule.py
Log:
fix un-normalizing exception bug
not certain this is the best fix


Modified: pypy/trunk/src/pypy/interpreter/pyframe.py
==============================================================================
--- pypy/trunk/src/pypy/interpreter/pyframe.py	(original)
+++ pypy/trunk/src/pypy/interpreter/pyframe.py	Thu Jun 10 18:29:32 2004
@@ -152,6 +152,9 @@
             if frame.space.full_exceptions:
                 w_normalized = normalize_exception(frame.space, w_type, w_value)
                 w_type, w_value = frame.space.unpacktuple(w_normalized, 2)
+                # this is to make sure that sys.exc_info() etc see
+                # normalized exception -- not sure here is best place!
+                operationerr.w_value = w_value
             # the stack setup is slightly different than in CPython:
             # instead of the traceback, we store the unroller object,
             # wrapped.

Modified: pypy/trunk/src/pypy/module/test/test_sysmodule.py
==============================================================================
--- pypy/trunk/src/pypy/module/test/test_sysmodule.py	(original)
+++ pypy/trunk/src/pypy/module/test/test_sysmodule.py	Thu Jun 10 18:29:32 2004
@@ -80,7 +80,16 @@
         self.assertEquals(exc_type2,Exception)
         self.assertEquals(exc_val2,e2)
         self.assertEquals(tb2.tb_lineno - tb.tb_lineno, 5)
-        
+
+    def test_exc_info_normalization(self):
+        import sys
+        try:
+            1/0
+        except ZeroDivisionError:
+            etype, val, tb = sys.exc_info()
+            self.assert_(isinstance(val, etype))
+        else:
+            self.fail("ZeroDivisionError not caught")
 
 if __name__ == '__main__':
     testit.main()



More information about the Pypy-commit mailing list