diff options
Diffstat (limited to 'Python')
-rw-r--r-- | Python/bltinmodule.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index 082f64c..a846377 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -402,7 +402,7 @@ a common type, using the same rules as used by arithmetic operations.\n\ If coercion is not possible, raise TypeError."); static PyObject * -builtin_compile(PyObject *self, PyObject *args) +builtin_compile(PyObject *self, PyObject *args, PyObject *kwds) { char *str; char *filename; @@ -413,9 +413,12 @@ builtin_compile(PyObject *self, PyObject *args) PyCompilerFlags cf; PyObject *result = NULL, *cmd, *tmp = NULL; Py_ssize_t length; + static char *kwlist[] = {"source", "filename", "mode", "flags", + "dont_inherit", NULL}; - if (!PyArg_ParseTuple(args, "Oss|ii:compile", &cmd, &filename, - &startstr, &supplied_flags, &dont_inherit)) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "Oss|ii:compile", + kwlist, &cmd, &filename, &startstr, + &supplied_flags, &dont_inherit)) return NULL; cf.cf_flags = supplied_flags; @@ -2237,7 +2240,7 @@ static PyMethodDef builtin_methods[] = { {"chr", builtin_chr, METH_VARARGS, chr_doc}, {"cmp", builtin_cmp, METH_VARARGS, cmp_doc}, {"coerce", builtin_coerce, METH_VARARGS, coerce_doc}, - {"compile", builtin_compile, METH_VARARGS, compile_doc}, + {"compile", (PyCFunction)builtin_compile, METH_VARARGS | METH_KEYWORDS, compile_doc}, {"delattr", builtin_delattr, METH_VARARGS, delattr_doc}, {"dir", builtin_dir, METH_VARARGS, dir_doc}, {"divmod", builtin_divmod, METH_VARARGS, divmod_doc}, |