Author: Philip Jenvey <[email protected]>
Branch: py3.3
Changeset: r72776:a52dc76c7d2f
Date: 2014-08-12 15:19 -0700
http://bitbucket.org/pypy/pypy/changeset/a52dc76c7d2f/

Log:    Merged in numerodix/pypy/py3.3-fixes2 (pull request #267)

        sys.exit() should produce a SystemExit with code is None

diff --git a/pypy/module/exceptions/test/test_exc.py 
b/pypy/module/exceptions/test/test_exc.py
--- a/pypy/module/exceptions/test/test_exc.py
+++ b/pypy/module/exceptions/test/test_exc.py
@@ -127,6 +127,24 @@
         assert SystemExit("x").code == "x"
         assert SystemExit(1, 2).code == (1, 2)
 
+    def test_sys_exit(self):
+        import sys
+
+        exc = raises(SystemExit, sys.exit)
+        assert exc.value.code is None
+
+        exc = raises(SystemExit, sys.exit, 0)
+        assert exc.value.code == 0
+
+        exc = raises(SystemExit, sys.exit, 1)
+        assert exc.value.code == 1
+
+        exc = raises(SystemExit, sys.exit, 2)
+        assert exc.value.code == 2
+
+        exc = raises(SystemExit, sys.exit, (1, 2, 3))
+        assert exc.value.code == (1, 2, 3)
+
     def test_str_unicode(self):
         e = ValueError('&#224;&#232;&#236;')
         assert str(e) == '&#224;&#232;&#236;'
diff --git a/pypy/module/sys/app.py b/pypy/module/sys/app.py
--- a/pypy/module/sys/app.py
+++ b/pypy/module/sys/app.py
@@ -49,7 +49,7 @@
     except:
         return False    # got an exception again... ignore, report the original
 
-def exit(exitcode=0):
+def exit(exitcode=None):
     """Exit the interpreter by raising SystemExit(exitcode).
 If the exitcode is omitted or None, it defaults to zero (i.e., success).
 If the exitcode is numeric, it will be used as the system exit status.
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to