Fix refleaks exposed by test_raise.
diff --git a/Lib/test/test_raise.py b/Lib/test/test_raise.py
index 0e19972..27a5cbc 100644
--- a/Lib/test/test_raise.py
+++ b/Lib/test/test_raise.py
@@ -37,6 +37,18 @@
         else:
             self.fail("No exception raised")
 
+    def test_erroneous_exception(self):
+        class MyException(Exception):
+            def __init__(self):
+                raise RuntimeError()
+
+        try:
+            raise MyException
+        except RuntimeError:
+            pass
+        else:
+            self.fail("No exception raised")
+
 
 class TestCause(unittest.TestCase):
     def test_invalid_cause(self):
@@ -64,6 +76,18 @@
         else:
             self.fail("No exception raised")
 
+    def test_erroneous_cause(self):
+        class MyException(Exception):
+            def __init__(self):
+                raise RuntimeError()
+
+        try:
+            raise IndexError from MyException
+        except RuntimeError:
+            pass
+        else:
+            self.fail("No exception raised")
+
 
 class TestTraceback(unittest.TestCase):
     def test_sets_traceback(self):