summaryrefslogtreecommitdiff
path: root/Lib/test/test_exceptions.py
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2011-07-15 14:15:40 -0500
committerBenjamin Peterson <benjamin@python.org>2011-07-15 14:15:40 -0500
commitc3349cd22e9877a0516d8baa71530f87bf5ac430 (patch)
treede647565e7bf267a9fa1b2371ab8c8f08275e65a /Lib/test/test_exceptions.py
parent2659140a5d0fbace2826320c0c3130e356c3c94b (diff)
downloadcpython-git-c3349cd22e9877a0516d8baa71530f87bf5ac430.tar.gz
port 8d05f697acd4 (#11627)
Diffstat (limited to 'Lib/test/test_exceptions.py')
-rw-r--r--Lib/test/test_exceptions.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_exceptions.py b/Lib/test/test_exceptions.py
index a19c82d066..5526fb77eb 100644
--- a/Lib/test/test_exceptions.py
+++ b/Lib/test/test_exceptions.py
@@ -464,6 +464,14 @@ class ExceptionTests(unittest.TestCase):
self.assertTrue(e is RuntimeError, e)
self.assertIn("maximum recursion depth exceeded", str(v))
+ def test_new_returns_invalid_instance(self):
+ # See issue #11627.
+ class MyException(Exception):
+ def __new__(cls, *args):
+ return object()
+
+ with self.assertRaises(TypeError):
+ raise MyException
# Helper class used by TestSameStrAndUnicodeMsg