summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorZachary Ware <zachary.ware@gmail.com>2014-02-19 16:44:47 (GMT)
committerZachary Ware <zachary.ware@gmail.com>2014-02-19 16:44:47 (GMT)
commit1f9e6017653596775e4fd582a7f4d64ac86eb8bc (patch)
tree02a8620259395e1ab36ef6b1eac10ca7b8f093dd /Lib
parente95977621de92f99153d48d2c4dde9cbdff6e3a7 (diff)
downloadcpython-1f9e6017653596775e4fd582a7f4d64ac86eb8bc.zip
cpython-1f9e6017653596775e4fd582a7f4d64ac86eb8bc.tar.gz
cpython-1f9e6017653596775e4fd582a7f4d64ac86eb8bc.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.
Diffstat (limited to 'Lib')
-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 491ae9c..f768e9b 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'')