LCOV - code coverage report
Current view: top level - Modules/clinic - socketmodule.c.h (source / functions) Hit Total Coverage
Test: CPython lcov report Lines: 30 36 83.3 %
Date: 2022-07-07 18:19:46 Functions: 1 1 100.0 %

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

Generated by: LCOV version 1.14