This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Py_Main() removal of exit() calls. Return value instead
Type: Stage:
Components: Extension Modules Versions:
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: Nosy List: derivin, loewis
Priority: normal Keywords: patch

Created on 2003-01-21 21:11 by derivin, last changed 2022-04-10 16:06 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
main.c.diff derivin, 2003-01-21 21:16 correct diff
Messages (2)
msg42514 - (view) Author: Douglas Napoleone (derivin) Date: 2003-01-21 21:11
Py_Main() does not perform to spec.
The C/API documentation notes that the function will 
return a value of 2 for imporper commandline values.
Instead it calls exit()

calling exit() in general is bad. The caller should be the 
one to call exit or return from main() with the supplied 
exit code.

this is particularly troublesome when there are end 
cleanup calls that need to be made before terminating 
the program and static destruction is not an option.

The patch just replaces the exit calls with a return.
Calls to usage() have their return value returned.

very streight forward

msg42515 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2003-03-30 17:24
Logged In: YES 
user_id=21627

Thanks for the patch. Applied as main.c 1.77.
History
Date User Action Args
2022-04-10 16:06:10adminsetgithub: 37815
2003-01-21 21:11:58derivincreate