From c77d4ba85b4d2f08b4de094bc9d9104113772374 Mon Sep 17 00:00:00 2001 From: Zachary Ware Date: Wed, 19 Feb 2014 10:43:13 -0600 Subject: [PATCH] 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. --- Lib/test/test_sys.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py index 7c7e0af849..745e4ada8c 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'') -- 2.50.1