1/*[clinic input]
2preserve
3[clinic start generated code]*/
4
5static int
6sock_initobj_impl(PySocketSockObject *self, int family, int type, int proto,
7                  PyObject *fdobj);
8
9static int
10sock_initobj(PyObject *self, PyObject *args, PyObject *kwargs)
11{
12    int return_value = -1;
13    static const char * const _keywords[] = {"family", "type", "proto", "fileno", NULL};
14    static _PyArg_Parser _parser = {NULL, _keywords, "socket", 0};
15    PyObject *argsbuf[4];
16    PyObject * const *fastargs;
17    Py_ssize_t nargs = PyTuple_GET_SIZE(args);
18    Py_ssize_t noptargs = nargs + (kwargs ? PyDict_GET_SIZE(kwargs) : 0) - 0;
19    int family = -1;
20    int type = -1;
21    int proto = -1;
22    PyObject *fdobj = NULL;
23
24    fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 0, 4, 0, argsbuf);
25    if (!fastargs) {
26        goto exit;
27    }
28    if (!noptargs) {
29        goto skip_optional_pos;
30    }
31    if (fastargs[0]) {
32        family = _PyLong_AsInt(fastargs[0]);
33        if (family == -1 && PyErr_Occurred()) {
34            goto exit;
35        }
36        if (!--noptargs) {
37            goto skip_optional_pos;
38        }
39    }
40    if (fastargs[1]) {
41        type = _PyLong_AsInt(fastargs[1]);
42        if (type == -1 && PyErr_Occurred()) {
43            goto exit;
44        }
45        if (!--noptargs) {
46            goto skip_optional_pos;
47        }
48    }
49    if (fastargs[2]) {
50        proto = _PyLong_AsInt(fastargs[2]);
51        if (proto == -1 && PyErr_Occurred()) {
52            goto exit;
53        }
54        if (!--noptargs) {
55            goto skip_optional_pos;
56        }
57    }
58    fdobj = fastargs[3];
59skip_optional_pos:
60    return_value = sock_initobj_impl((PySocketSockObject *)self, family, type, proto, fdobj);
61
62exit:
63    return return_value;
64}
65/*[clinic end generated code: output=2433d6ac51bc962a input=a9049054013a1b77]*/
66