summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2002-03-27 13:03:09 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2002-03-27 13:03:09 (GMT)
commit0c766a0bb62877a1080acf3c70ca6ed393d9e7fc (patch)
treec4ef3ebf091a8b8a7463fe37c4479e4a6ec36e19 /Python
parent496f9e41ef01965caf747533acee3611871067b2 (diff)
downloadcpython-0c766a0bb62877a1080acf3c70ca6ed393d9e7fc.zip
cpython-0c766a0bb62877a1080acf3c70ca6ed393d9e7fc.tar.gz
cpython-0c766a0bb62877a1080acf3c70ca6ed393d9e7fc.tar.bz2
Change sys_exit to use METH_VARARGS.
sys.exit() now requires 0-1 arguments. Previously 2+ arguments were allowed.
Diffstat (limited to 'Python')
-rw-r--r--Python/sysmodule.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/Python/sysmodule.c b/Python/sysmodule.c
index 581a19b..0469c7f 100644
--- a/Python/sysmodule.c
+++ b/Python/sysmodule.c
@@ -146,8 +146,11 @@ This should be called from inside an except clause only.";
static PyObject *
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, args);
+ PyErr_SetObject(PyExc_SystemExit, exit_code);
return NULL;
}
@@ -528,7 +531,7 @@ static PyMethodDef sys_methods[] = {
{"displayhook", sys_displayhook, METH_O, displayhook_doc},
{"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},
+ {"exit", sys_exit, METH_VARARGS, exit_doc},
#ifdef Py_USING_UNICODE
{"getdefaultencoding", (PyCFunction)sys_getdefaultencoding, METH_NOARGS,
getdefaultencoding_doc},