New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Different exit status when using -m #59238
Comments
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. |
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. |
Fixed for 3.3. Does this need to be back ported as well? |
And by 'Fixed' I of course meant 'Patched, awaiting review'. |
New changeset fcbd3bda7c0f by Senthil Kumaran in branch '3.2': New changeset 1186d68715cc by Senthil Kumaran in branch 'default': |
New changeset 55b3de6d701e by Senthil Kumaran in branch '2.7': |
Thanks for the patch Jeff and thanks for the guidance, Nick. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: