mirror of
https://github.com/python/cpython.git
synced 2025-08-01 07:33:08 +00:00
port 8d05f697acd4 (#11627)
This commit is contained in:
parent
2659140a5d
commit
c3349cd22e
3 changed files with 21 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue