[Python-bugs-list] [ python-Bugs-672035 ] Py_Main() does not perform to spec
SourceForge.net
noreply@sourceforge.net
Tue, 21 Jan 2003 12:42:23 -0800
Bugs item #672035, was opened at 2003-01-21 15:42
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=672035&group_id=5470
Category: Extension Modules
Group: Python 2.2.2
Status: Open
Resolution: None
Priority: 5
Submitted By: Douglas Napoleone (derivin)
Assigned to: Nobody/Anonymous (nobody)
Summary: Py_Main() does not perform to spec
Initial Comment:
I consider this a code bug, not a documentation issue
as the documentation is the behavior we want.
>From
http://www.python.org/doc/current/api/veryhigh.html#l2h-
47 :
int Py_Main(int argc, char **argv)
The main program for the standard interpreter. This is
made available for programs which embed Python. The
argc and argv parameters should be prepared exactly as
those which are passed to a C program's main()
function. It is important to note that the argument list
may be modified (but the contents of the strings pointed
to by the argument list are not). The return value will be
the integer passed to the sys.exit() function, 1 if the
interpreter exits due to an exception, or 2 if the
parameter list does not represent a valid Python
command line.
I have checked the code for 2.2, 2.2.1, 2.2.2, and r2.3al
In all cases the code will call exit(2) in C when an
improper commandline is given instead of returning 2.
ALL exit() calls should be removed from this module.
The return value should be passed to exit or returned
from main() by the caller of Py_Main() and NOT from
within this call.
python.c's main() would not need to be changed as it
already does this.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=672035&group_id=5470