Implicit exception chaining via __context__ (PEP 3134).
Patch 3108 by Antooine Pitrou.
diff --git a/Lib/test/test_exceptions.py b/Lib/test/test_exceptions.py
index 9068554..55a57ba 100644
--- a/Lib/test/test_exceptions.py
+++ b/Lib/test/test_exceptions.py
@@ -480,7 +480,12 @@
inner_raising_func()
except:
raise KeyError
- except KeyError:
+ except KeyError as e:
+ # We want to test that the except block above got rid of
+ # the exception raised in inner_raising_func(), but it
+ # also ends up in the __context__ of the KeyError, so we
+ # must clear the latter manually for our test to succeed.
+ e.__context__ = None
obj = None
obj = wr()
self.failUnless(obj is None, "%s" % obj)