[Python-checkins] cpython (3.3): Issue #20510: Confirm that the code attribute of the SystemExit

zach.ware python-checkins at python.org
Wed Feb 19 17:46:33 CET 2014


http://hg.python.org/cpython/rev/71411d5f3c8b
changeset:   89275:71411d5f3c8b
branch:      3.3
parent:      89272:6227b0ecb5fb
user:        Zachary Ware <zachary.ware at gmail.com>
date:        Wed Feb 19 10:44:47 2014 -0600
summary:
  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.

files:
  Lib/test/test_sys.py |  4 ++++
  1 files changed, 4 insertions(+), 0 deletions(-)


diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py
--- a/Lib/test/test_sys.py
+++ b/Lib/test/test_sys.py
@@ -91,6 +91,10 @@
         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'')

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list