From: Zachary Ware Date: Wed, 19 Feb 2014 16:44:47 +0000 (-0600) Subject: Issue #20510: Confirm that the code attribute of the SystemExit X-Git-Tag: v3.3.5rc1^2~6^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1f9e6017653596775e4fd582a7f4d64ac86eb8bc;p=python 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. --- diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py index 491ae9ce3e..f768e9b7c3 100644 --- a/Lib/test/test_sys.py +++ b/Lib/test/test_sys.py @@ -91,6 +91,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'')