[pypy-commit] pypy py3k: python3 no longer supports the form 'raise Type, value, tb'. Instead, we can use __traceback__. Adapt the test to the new semantics: it passes with -A but still fails on py.py

antocuni noreply at buildbot.pypy.org
Fri Feb 10 14:49:51 CET 2012


Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: py3k
Changeset: r52352:c369a075fa90
Date: 2012-02-10 11:49 +0100
http://bitbucket.org/pypy/pypy/changeset/c369a075fa90/

Log:	python3 no longer supports the form 'raise Type, value, tb'.
	Instead, we can use __traceback__. Adapt the test to the new
	semantics: it passes with -A but still fails on py.py

diff --git a/pypy/interpreter/test/test_raise.py b/pypy/interpreter/test/test_raise.py
--- a/pypy/interpreter/test/test_raise.py
+++ b/pypy/interpreter/test/test_raise.py
@@ -50,19 +50,20 @@
         else:
             raise AssertionError("shouldn't be able to raise 1")
 
-    def test_raise_three_args(self):
+    def test_raise_with___traceback__(self):
         import sys
         try:
             raise ValueError
         except:
             exc_type,exc_val,exc_tb = sys.exc_info()
         try:
-            raise exc_type,exc_val,exc_tb
+            exc_val.__traceback__ = exc_tb
+            raise exc_val
         except:
             exc_type2,exc_val2,exc_tb2 = sys.exc_info()
-        assert exc_type ==exc_type2
-        assert exc_val ==exc_val2
-        assert exc_tb ==exc_tb2
+        assert exc_type is exc_type2
+        assert exc_val is exc_val2
+        assert exc_tb is exc_tb2.tb_next
 
     def test_reraise(self):
         # some collection of funny code


More information about the pypy-commit mailing list