summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZachary Ware <zachary.ware@gmail.com>2014-02-19 16:43:13 (GMT)
committerZachary Ware <zachary.ware@gmail.com>2014-02-19 16:43:13 (GMT)
commitc77d4ba85b4d2f08b4de094bc9d9104113772374 (patch)
tree47abb8e7b88321afddc751672663490d5de77720
parent3e0cb09e33f37543d096dae1fc38e6cc314f887e (diff)
downloadcpython-c77d4ba85b4d2f08b4de094bc9d9104113772374.zip
cpython-c77d4ba85b4d2f08b4de094bc9d9104113772374.tar.gz
cpython-c77d4ba85b4d2f08b4de094bc9d9104113772374.tar.bz2
Issue #20510: Confirm that the code attribute of the SystemExit
exception raised by sys.exit is None when no code is given. As suggested by Serhiy Storchaka.
-rw-r--r--Lib/test/test_sys.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py
index 7c7e0af..745e4ad 100644
--- a/Lib/test/test_sys.py
+++ b/Lib/test/test_sys.py
@@ -119,6 +119,10 @@ class SysModuleTest(unittest.TestCase):
self.assertRaises(TypeError, sys.exit, 42, 42)
# call without argument
+ with self.assertRaises(SystemExit) as cm:
+ sys.exit()
+ self.assertIsNone(cm.exception.code)
+
rc, out, err = assert_python_ok('-c', 'import sys; sys.exit()')
self.assertEqual(rc, 0)
self.assertEqual(out, b'')