Line data Source code
1 : /*[clinic input] 2 : preserve 3 : [clinic start generated code]*/ 4 : 5 : PyDoc_STRVAR(module___init____doc__, 6 : "module(name, doc=None)\n" 7 : "--\n" 8 : "\n" 9 : "Create a module object.\n" 10 : "\n" 11 : "The name must be a string; the optional doc argument can have any type."); 12 : 13 : static int 14 : module___init___impl(PyModuleObject *self, PyObject *name, PyObject *doc); 15 : 16 : static int 17 213240 : module___init__(PyObject *self, PyObject *args, PyObject *kwargs) 18 : { 19 213240 : int return_value = -1; 20 : static const char * const _keywords[] = {"name", "doc", NULL}; 21 : static _PyArg_Parser _parser = {NULL, _keywords, "module", 0}; 22 : PyObject *argsbuf[2]; 23 : PyObject * const *fastargs; 24 213240 : Py_ssize_t nargs = PyTuple_GET_SIZE(args); 25 213240 : Py_ssize_t noptargs = nargs + (kwargs ? PyDict_GET_SIZE(kwargs) : 0) - 1; 26 : PyObject *name; 27 213240 : PyObject *doc = Py_None; 28 : 29 213240 : fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 1, 2, 0, argsbuf); 30 213240 : if (!fastargs) { 31 0 : goto exit; 32 : } 33 213240 : if (!PyUnicode_Check(fastargs[0])) { 34 0 : _PyArg_BadArgument("module", "argument 'name'", "str", fastargs[0]); 35 0 : goto exit; 36 : } 37 213240 : if (PyUnicode_READY(fastargs[0]) == -1) { 38 0 : goto exit; 39 : } 40 213240 : name = fastargs[0]; 41 213240 : if (!noptargs) { 42 213234 : goto skip_optional_pos; 43 : } 44 6 : doc = fastargs[1]; 45 213240 : skip_optional_pos: 46 213240 : return_value = module___init___impl((PyModuleObject *)self, name, doc); 47 : 48 213240 : exit: 49 213240 : return return_value; 50 : } 51 : /*[clinic end generated code: output=680276bc3a496d7a input=a9049054013a1b77]*/