diff options
author | Victor Stinner <victor.stinner@haypocalc.com> | 2011-05-15 16:57:44 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@haypocalc.com> | 2011-05-15 16:57:44 (GMT) |
commit | d0e11ec5b07c7c49061a2e4a73a0c231d9b46ad7 (patch) | |
tree | 3b579a69db5721b11b89d9c18aa0ab14272f520e /Lib | |
parent | 2ec6b176bd0fc41c6d00f244a4d8d6bdefa2c620 (diff) | |
download | cpython-d0e11ec5b07c7c49061a2e4a73a0c231d9b46ad7.zip cpython-d0e11ec5b07c7c49061a2e4a73a0c231d9b46ad7.tar.gz cpython-d0e11ec5b07c7c49061a2e4a73a0c231d9b46ad7.tar.bz2 |
Issue #10756: atexit normalizes the exception before displaying it. Patch by
Andreas Stührk.
Backport a fix already applied to Python 3.2+ (4a82be47a948 + 5060a92a8597).
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_atexit.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_atexit.py b/Lib/test/test_atexit.py index 8a71036..9c7e109 100644 --- a/Lib/test/test_atexit.py +++ b/Lib/test/test_atexit.py @@ -65,6 +65,14 @@ class TestCase(unittest.TestCase): self.assertRaises(TypeError, atexit._run_exitfuncs) + def test_raise_unnormalized(self): + # Issue #10756: Make sure that an unnormalized exception is + # handled properly + atexit.register(lambda: 1 / 0) + + self.assertRaises(ZeroDivisionError, atexit._run_exitfuncs) + self.assertIn("ZeroDivisionError", self.stream.getvalue()) + def test_stress(self): a = [0] def inc(): |