Mailing List Archive

CVS: python/dist/src/Python sysmodule.c,2.102,2.103
Update of /cvsroot/python/python/dist/src/Python
In directory usw-pr-cvs1:/tmp/cvs-serv31861/Python

Modified Files:
sysmodule.c
Log Message:
Change sys_exit to use METH_VARARGS.
sys.exit() now requires 0-1 arguments. Previously 2+ arguments were allowed.


Index: sysmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/sysmodule.c,v
retrieving revision 2.102
retrieving revision 2.103
diff -C2 -d -r2.102 -r2.103
*** sysmodule.c 23 Mar 2002 20:46:35 -0000 2.102
--- sysmodule.c 27 Mar 2002 13:03:09 -0000 2.103
***************
*** 147,152 ****
sys_exit(PyObject *self, PyObject *args)
{
/* Raise SystemExit so callers may catch it or clean up. */
! PyErr_SetObject(PyExc_SystemExit, args);
return NULL;
}
--- 147,155 ----
sys_exit(PyObject *self, PyObject *args)
{
+ PyObject *exit_code = 0;
+ if (!PyArg_ParseTuple(args, "|O:exit", &exit_code))
+ return NULL;
/* Raise SystemExit so callers may catch it or clean up. */
! PyErr_SetObject(PyExc_SystemExit, exit_code);
return NULL;
}
***************
*** 529,533 ****
{"exc_info", (PyCFunction)sys_exc_info, METH_NOARGS, exc_info_doc},
{"excepthook", sys_excepthook, METH_VARARGS, excepthook_doc},
! {"exit", sys_exit, METH_OLDARGS, exit_doc},
#ifdef Py_USING_UNICODE
{"getdefaultencoding", (PyCFunction)sys_getdefaultencoding, METH_NOARGS,
--- 532,536 ----
{"exc_info", (PyCFunction)sys_exc_info, METH_NOARGS, exc_info_doc},
{"excepthook", sys_excepthook, METH_VARARGS, excepthook_doc},
! {"exit", sys_exit, METH_VARARGS, exit_doc},
#ifdef Py_USING_UNICODE
{"getdefaultencoding", (PyCFunction)sys_getdefaultencoding, METH_NOARGS,