cpython: 55b3de6d701e (original) (raw)

Mercurial > cpython

changeset 77948:55b3de6d701e 2.7

Fix closes issue # 15033 - Return the proper exitcode for failure when modules are invoked using -m switch. Patch contributed by Jeff Knupp [#15033]

Senthil Kumaran senthil@uthcode.com
date Wed, 04 Jul 2012 19:50:29 -0700
parents 2de5c9ced464
children d7040647d590
files Lib/test/test_cmd_line_script.py Misc/NEWS Modules/main.c
diffstat 3 files changed, 21 insertions(+), 2 deletions(-)[+] [-] Lib/test/test_cmd_line_script.py 18 Misc/NEWS 3 Modules/main.c 2

line wrap: on

line diff

--- a/Lib/test/test_cmd_line_script.py +++ b/Lib/test/test_cmd_line_script.py @@ -6,11 +6,14 @@ import os.path import test.test_support from test.script_helper import (run_python, temp_dir, make_script, compile_script,

verbose = test.test_support.verbose +example_args = ['test1', 'test2', 'test3'] + test_source = """[](#l1.16)

Script may be run with optimisation enabled, so don't rely on assert

statements being executed

@@ -204,6 +207,19 @@ class CmdLineTest(unittest.TestCase): launch_name = _make_launch_script(script_dir, 'launch', 'test_pkg') self._check_import_error(launch_name, msg)

+ def test_main(): test.test_support.run_unittest(CmdLineTest)

--- a/Misc/NEWS +++ b/Misc/NEWS @@ -9,6 +9,9 @@ What's New in Python 2.7.4 Core and Builtins ----------------- +- Issue #15033: Fix the exit status bug when modules invoked using -m swith,

--- a/Modules/main.c +++ b/Modules/main.c @@ -583,7 +583,7 @@ Py_Main(int argc, char **argv) sts = PyRun_SimpleStringFlags(command, &cf) != 0; free(command); } else if (module) {