LCOV - code coverage report
Current view: top level - Modules/_testcapi/clinic - vectorcall.c.h (source / functions) Hit Total Coverage
Test: CPython 3.12 LCOV report [commit 5e6661bce9] Lines: 0 36 0.0 %
Date: 2023-03-20 08:15:36 Functions: 0 3 0.0 %
Branches: 0 18 0.0 %

           Branch data     Line data    Source code
       1                 :            : /*[clinic input]
       2                 :            : preserve
       3                 :            : [clinic start generated code]*/
       4                 :            : 
       5                 :            : #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
       6                 :            : #  include "pycore_gc.h"            // PyGC_Head
       7                 :            : #  include "pycore_runtime.h"       // _Py_ID()
       8                 :            : #endif
       9                 :            : 
      10                 :            : 
      11                 :            : PyDoc_STRVAR(_testcapi_VectorCallClass_set_vectorcall__doc__,
      12                 :            : "set_vectorcall($self, type, /)\n"
      13                 :            : "--\n"
      14                 :            : "\n"
      15                 :            : "Set self\'s vectorcall function for `type` to one that returns \"vectorcall\"");
      16                 :            : 
      17                 :            : #define _TESTCAPI_VECTORCALLCLASS_SET_VECTORCALL_METHODDEF    \
      18                 :            :     {"set_vectorcall", (PyCFunction)_testcapi_VectorCallClass_set_vectorcall, METH_O, _testcapi_VectorCallClass_set_vectorcall__doc__},
      19                 :            : 
      20                 :            : static PyObject *
      21                 :            : _testcapi_VectorCallClass_set_vectorcall_impl(PyObject *self,
      22                 :            :                                               PyTypeObject *type);
      23                 :            : 
      24                 :            : static PyObject *
      25                 :          0 : _testcapi_VectorCallClass_set_vectorcall(PyObject *self, PyObject *arg)
      26                 :            : {
      27                 :          0 :     PyObject *return_value = NULL;
      28                 :            :     PyTypeObject *type;
      29                 :            : 
      30         [ #  # ]:          0 :     if (!PyObject_TypeCheck(arg, &PyType_Type)) {
      31                 :          0 :         _PyArg_BadArgument("set_vectorcall", "argument", (&PyType_Type)->tp_name, arg);
      32                 :          0 :         goto exit;
      33                 :            :     }
      34                 :          0 :     type = (PyTypeObject *)arg;
      35                 :          0 :     return_value = _testcapi_VectorCallClass_set_vectorcall_impl(self, type);
      36                 :            : 
      37                 :          0 : exit:
      38                 :          0 :     return return_value;
      39                 :            : }
      40                 :            : 
      41                 :            : PyDoc_STRVAR(_testcapi_make_vectorcall_class__doc__,
      42                 :            : "make_vectorcall_class($module, base=<unrepresentable>, /)\n"
      43                 :            : "--\n"
      44                 :            : "\n"
      45                 :            : "Create a class whose instances return \"tpcall\" when called.\n"
      46                 :            : "\n"
      47                 :            : "When the \"set_vectorcall\" method is called on an instance, a vectorcall\n"
      48                 :            : "function that returns \"vectorcall\" will be installed.");
      49                 :            : 
      50                 :            : #define _TESTCAPI_MAKE_VECTORCALL_CLASS_METHODDEF    \
      51                 :            :     {"make_vectorcall_class", _PyCFunction_CAST(_testcapi_make_vectorcall_class), METH_FASTCALL, _testcapi_make_vectorcall_class__doc__},
      52                 :            : 
      53                 :            : static PyObject *
      54                 :            : _testcapi_make_vectorcall_class_impl(PyObject *module, PyTypeObject *base);
      55                 :            : 
      56                 :            : static PyObject *
      57                 :          0 : _testcapi_make_vectorcall_class(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
      58                 :            : {
      59                 :          0 :     PyObject *return_value = NULL;
      60                 :          0 :     PyTypeObject *base = NULL;
      61                 :            : 
      62   [ #  #  #  #  :          0 :     if (!_PyArg_CheckPositional("make_vectorcall_class", nargs, 0, 1)) {
                   #  # ]
      63                 :          0 :         goto exit;
      64                 :            :     }
      65         [ #  # ]:          0 :     if (nargs < 1) {
      66                 :          0 :         goto skip_optional;
      67                 :            :     }
      68         [ #  # ]:          0 :     if (!PyObject_TypeCheck(args[0], &PyType_Type)) {
      69                 :          0 :         _PyArg_BadArgument("make_vectorcall_class", "argument 1", (&PyType_Type)->tp_name, args[0]);
      70                 :          0 :         goto exit;
      71                 :            :     }
      72                 :          0 :     base = (PyTypeObject *)args[0];
      73                 :          0 : skip_optional:
      74                 :          0 :     return_value = _testcapi_make_vectorcall_class_impl(module, base);
      75                 :            : 
      76                 :          0 : exit:
      77                 :          0 :     return return_value;
      78                 :            : }
      79                 :            : 
      80                 :            : PyDoc_STRVAR(_testcapi_has_vectorcall_flag__doc__,
      81                 :            : "has_vectorcall_flag($module, type, /)\n"
      82                 :            : "--\n"
      83                 :            : "\n"
      84                 :            : "Return true iff Py_TPFLAGS_HAVE_VECTORCALL is set on the class.");
      85                 :            : 
      86                 :            : #define _TESTCAPI_HAS_VECTORCALL_FLAG_METHODDEF    \
      87                 :            :     {"has_vectorcall_flag", (PyCFunction)_testcapi_has_vectorcall_flag, METH_O, _testcapi_has_vectorcall_flag__doc__},
      88                 :            : 
      89                 :            : static int
      90                 :            : _testcapi_has_vectorcall_flag_impl(PyObject *module, PyTypeObject *type);
      91                 :            : 
      92                 :            : static PyObject *
      93                 :          0 : _testcapi_has_vectorcall_flag(PyObject *module, PyObject *arg)
      94                 :            : {
      95                 :          0 :     PyObject *return_value = NULL;
      96                 :            :     PyTypeObject *type;
      97                 :            :     int _return_value;
      98                 :            : 
      99         [ #  # ]:          0 :     if (!PyObject_TypeCheck(arg, &PyType_Type)) {
     100                 :          0 :         _PyArg_BadArgument("has_vectorcall_flag", "argument", (&PyType_Type)->tp_name, arg);
     101                 :          0 :         goto exit;
     102                 :            :     }
     103                 :          0 :     type = (PyTypeObject *)arg;
     104                 :          0 :     _return_value = _testcapi_has_vectorcall_flag_impl(module, type);
     105   [ #  #  #  # ]:          0 :     if ((_return_value == -1) && PyErr_Occurred()) {
     106                 :          0 :         goto exit;
     107                 :            :     }
     108                 :          0 :     return_value = PyBool_FromLong((long)_return_value);
     109                 :            : 
     110                 :          0 : exit:
     111                 :          0 :     return return_value;
     112                 :            : }
     113                 :            : /*[clinic end generated code: output=609569aa9942584f input=a9049054013a1b77]*/

Generated by: LCOV version 1.14