LCOV - code coverage report
Current view: top level - Modules/clinic - _testinternalcapi.c.h (source / functions) Hit Total Coverage
Test: CPython 3.12 LCOV report [commit 5e6661bce9] Lines: 0 23 0.0 %
Date: 2023-03-20 08:15:36 Functions: 0 2 0.0 %
Branches: 0 24 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(_testinternalcapi_compiler_codegen__doc__,
      12                 :            : "compiler_codegen($module, /, ast, filename, optimize)\n"
      13                 :            : "--\n"
      14                 :            : "\n"
      15                 :            : "Apply compiler code generation to an AST.");
      16                 :            : 
      17                 :            : #define _TESTINTERNALCAPI_COMPILER_CODEGEN_METHODDEF    \
      18                 :            :     {"compiler_codegen", _PyCFunction_CAST(_testinternalcapi_compiler_codegen), METH_FASTCALL|METH_KEYWORDS, _testinternalcapi_compiler_codegen__doc__},
      19                 :            : 
      20                 :            : static PyObject *
      21                 :            : _testinternalcapi_compiler_codegen_impl(PyObject *module, PyObject *ast,
      22                 :            :                                         PyObject *filename, int optimize);
      23                 :            : 
      24                 :            : static PyObject *
      25                 :          0 : _testinternalcapi_compiler_codegen(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
      26                 :            : {
      27                 :          0 :     PyObject *return_value = NULL;
      28                 :            :     #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
      29                 :            : 
      30                 :            :     #define NUM_KEYWORDS 3
      31                 :            :     static struct {
      32                 :            :         PyGC_Head _this_is_not_used;
      33                 :            :         PyObject_VAR_HEAD
      34                 :            :         PyObject *ob_item[NUM_KEYWORDS];
      35                 :            :     } _kwtuple = {
      36                 :            :         .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
      37                 :            :         .ob_item = { &_Py_ID(ast), &_Py_ID(filename), &_Py_ID(optimize), },
      38                 :            :     };
      39                 :            :     #undef NUM_KEYWORDS
      40                 :            :     #define KWTUPLE (&_kwtuple.ob_base.ob_base)
      41                 :            : 
      42                 :            :     #else  // !Py_BUILD_CORE
      43                 :            :     #  define KWTUPLE NULL
      44                 :            :     #endif  // !Py_BUILD_CORE
      45                 :            : 
      46                 :            :     static const char * const _keywords[] = {"ast", "filename", "optimize", NULL};
      47                 :            :     static _PyArg_Parser _parser = {
      48                 :            :         .keywords = _keywords,
      49                 :            :         .fname = "compiler_codegen",
      50                 :            :         .kwtuple = KWTUPLE,
      51                 :            :     };
      52                 :            :     #undef KWTUPLE
      53                 :            :     PyObject *argsbuf[3];
      54                 :            :     PyObject *ast;
      55                 :            :     PyObject *filename;
      56                 :            :     int optimize;
      57                 :            : 
      58   [ #  #  #  #  :          0 :     args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 3, 3, 0, argsbuf);
             #  #  #  # ]
      59         [ #  # ]:          0 :     if (!args) {
      60                 :          0 :         goto exit;
      61                 :            :     }
      62                 :          0 :     ast = args[0];
      63                 :          0 :     filename = args[1];
      64                 :          0 :     optimize = _PyLong_AsInt(args[2]);
      65   [ #  #  #  # ]:          0 :     if (optimize == -1 && PyErr_Occurred()) {
      66                 :          0 :         goto exit;
      67                 :            :     }
      68                 :          0 :     return_value = _testinternalcapi_compiler_codegen_impl(module, ast, filename, optimize);
      69                 :            : 
      70                 :          0 : exit:
      71                 :          0 :     return return_value;
      72                 :            : }
      73                 :            : 
      74                 :            : PyDoc_STRVAR(_testinternalcapi_optimize_cfg__doc__,
      75                 :            : "optimize_cfg($module, /, instructions, consts)\n"
      76                 :            : "--\n"
      77                 :            : "\n"
      78                 :            : "Apply compiler optimizations to an instruction list.");
      79                 :            : 
      80                 :            : #define _TESTINTERNALCAPI_OPTIMIZE_CFG_METHODDEF    \
      81                 :            :     {"optimize_cfg", _PyCFunction_CAST(_testinternalcapi_optimize_cfg), METH_FASTCALL|METH_KEYWORDS, _testinternalcapi_optimize_cfg__doc__},
      82                 :            : 
      83                 :            : static PyObject *
      84                 :            : _testinternalcapi_optimize_cfg_impl(PyObject *module, PyObject *instructions,
      85                 :            :                                     PyObject *consts);
      86                 :            : 
      87                 :            : static PyObject *
      88                 :          0 : _testinternalcapi_optimize_cfg(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
      89                 :            : {
      90                 :          0 :     PyObject *return_value = NULL;
      91                 :            :     #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
      92                 :            : 
      93                 :            :     #define NUM_KEYWORDS 2
      94                 :            :     static struct {
      95                 :            :         PyGC_Head _this_is_not_used;
      96                 :            :         PyObject_VAR_HEAD
      97                 :            :         PyObject *ob_item[NUM_KEYWORDS];
      98                 :            :     } _kwtuple = {
      99                 :            :         .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
     100                 :            :         .ob_item = { &_Py_ID(instructions), &_Py_ID(consts), },
     101                 :            :     };
     102                 :            :     #undef NUM_KEYWORDS
     103                 :            :     #define KWTUPLE (&_kwtuple.ob_base.ob_base)
     104                 :            : 
     105                 :            :     #else  // !Py_BUILD_CORE
     106                 :            :     #  define KWTUPLE NULL
     107                 :            :     #endif  // !Py_BUILD_CORE
     108                 :            : 
     109                 :            :     static const char * const _keywords[] = {"instructions", "consts", NULL};
     110                 :            :     static _PyArg_Parser _parser = {
     111                 :            :         .keywords = _keywords,
     112                 :            :         .fname = "optimize_cfg",
     113                 :            :         .kwtuple = KWTUPLE,
     114                 :            :     };
     115                 :            :     #undef KWTUPLE
     116                 :            :     PyObject *argsbuf[2];
     117                 :            :     PyObject *instructions;
     118                 :            :     PyObject *consts;
     119                 :            : 
     120   [ #  #  #  #  :          0 :     args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 0, argsbuf);
             #  #  #  # ]
     121         [ #  # ]:          0 :     if (!args) {
     122                 :          0 :         goto exit;
     123                 :            :     }
     124                 :          0 :     instructions = args[0];
     125                 :          0 :     consts = args[1];
     126                 :          0 :     return_value = _testinternalcapi_optimize_cfg_impl(module, instructions, consts);
     127                 :            : 
     128                 :          0 : exit:
     129                 :          0 :     return return_value;
     130                 :            : }
     131                 :            : /*[clinic end generated code: output=efe95836482fd542 input=a9049054013a1b77]*/

Generated by: LCOV version 1.14