1 /*[clinic input]
2 preserve
3 [clinic start generated code]*/
4
5 PyDoc_STRVAR(func_new__doc__,
6 "function(code, globals, name=None, argdefs=None, closure=None)\n"
7 "--\n"
8 "\n"
9 "Create a function object.\n"
10 "\n"
11 " code\n"
12 " a code object\n"
13 " globals\n"
14 " the globals dictionary\n"
15 " name\n"
16 " a string that overrides the name from the code object\n"
17 " argdefs\n"
18 " a tuple that specifies the default argument values\n"
19 " closure\n"
20 " a tuple that supplies the bindings for free variables");
21
22 static PyObject *
23 func_new_impl(PyTypeObject *type, PyCodeObject *code, PyObject *globals,
24 PyObject *name, PyObject *defaults, PyObject *closure);
25
26 static PyObject *
func_new(PyTypeObject * type,PyObject * args,PyObject * kwargs)27 func_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
28 {
29 PyObject *return_value = NULL;
30 static const char * const _keywords[] = {"code", "globals", "name", "argdefs", "closure", NULL};
31 static _PyArg_Parser _parser = {"O!O!|OOO:function", _keywords, 0};
32 PyCodeObject *code;
33 PyObject *globals;
34 PyObject *name = Py_None;
35 PyObject *defaults = Py_None;
36 PyObject *closure = Py_None;
37
38 if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
39 &PyCode_Type, &code, &PyDict_Type, &globals, &name, &defaults, &closure)) {
40 goto exit;
41 }
42 return_value = func_new_impl(type, code, globals, name, defaults, closure);
43
44 exit:
45 return return_value;
46 }
47 /*[clinic end generated code: output=a6ab29e4dd33010a input=a9049054013a1b77]*/
48