[issue15033] Different exit status when using -m

2012-06-07 Thread Kamil Kisiel

New submission from Kamil Kisiel :

Python returns a different exit status when an exception is raised and -m is 
used as opposed to just running a module.

A short example, let's call it foo.py:

def main():
raise ValueError()

if __name__ == '__main__':
main()

When run with python foo.py the exit status of the process is 1. If run with 
python -mfoo the exit status of the process is 255.

--
messages: 162501
nosy: kisielk
priority: normal
severity: normal
status: open
title: Different exit status when using -m
type: behavior
versions: Python 2.6, Python 2.7, Python 3.2

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15033] Different exit status when using -m

2012-06-08 Thread Éric Araujo

Changes by Éric Araujo :


--
nosy: +eric.araujo, ncoghlan
versions: +Python 3.3 -Python 2.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15033] Different exit status when using -m

2012-06-12 Thread Nick Coghlan

Nick Coghlan  added the comment:

Technically, it returns -1 (which later gets coerced to an unsigned value).

However, there's no good reason for the inconsistency - the offending line 
(663) in main.c should be changed to be:

sts = (RunModule(module, 1) != 0);

It is currently just:

sts = RunModule(module, 1);

An additional test in test_cmd_line_script is also needed to ensure that both 
variants give a returncode of 1 in the future.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15033] Different exit status when using -m

2012-07-02 Thread Éric Araujo

Changes by Éric Araujo :


--
keywords: +easy
stage:  -> needs patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15033] Different exit status when using -m

2012-07-03 Thread Jeff Knupp

Jeff Knupp  added the comment:

Fixed for 3.3. Does this need to be back ported as well?

--
keywords: +patch
nosy: +Jeff.Knupp
Added file: http://bugs.python.org/file26244/exit_code.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15033] Different exit status when using -m

2012-07-03 Thread Jeff Knupp

Jeff Knupp  added the comment:

And by 'Fixed' I of course meant 'Patched, awaiting review'.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15033] Different exit status when using -m

2012-07-03 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
stage: needs patch -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15033] Different exit status when using -m

2012-07-04 Thread Arfrever Frehtes Taifersar Arahesis

Changes by Arfrever Frehtes Taifersar Arahesis :


--
nosy: +Arfrever

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15033] Different exit status when using -m

2012-07-04 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset fcbd3bda7c0f by Senthil Kumaran in branch '3.2':
Fix issue # 15033 - Return the proper exitcode for failure when modules are 
invoked using -m switch. Patch contributed by Jeff Knupp
http://hg.python.org/cpython/rev/fcbd3bda7c0f

New changeset 1186d68715cc by Senthil Kumaran in branch 'default':
Fix issue # 15033 - Return the proper exitcode for failure when modules are 
invoked using -m switch. Patch contributed by Jeff Knupp
http://hg.python.org/cpython/rev/1186d68715cc

--
nosy: +python-dev

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15033] Different exit status when using -m

2012-07-04 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 55b3de6d701e by Senthil Kumaran in branch '2.7':
Fix closes issue # 15033 - Return the proper exitcode for failure when modules 
are invoked using -m switch. Patch contributed by Jeff Knupp
http://hg.python.org/cpython/rev/55b3de6d701e

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15033] Different exit status when using -m

2012-07-04 Thread Senthil Kumaran

Senthil Kumaran  added the comment:

Thanks for the patch Jeff and thanks for the guidance, Nick. 
Committed this in all branches.

--
nosy: +orsenthil
resolution:  -> fixed
stage: patch review -> committed/rejected
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com