LCOV - code coverage report
Current view: top level - Python/clinic - import.c.h (source / functions) Hit Total Coverage
Test: CPython 3.12 LCOV report [commit 5e6661bce9] Lines: 93 175 53.1 %
Date: 2023-03-20 08:15:36 Functions: 12 18 66.7 %
Branches: 30 104 28.8 %

           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(_imp_lock_held__doc__,
      12                 :            : "lock_held($module, /)\n"
      13                 :            : "--\n"
      14                 :            : "\n"
      15                 :            : "Return True if the import lock is currently held, else False.\n"
      16                 :            : "\n"
      17                 :            : "On platforms without threads, return False.");
      18                 :            : 
      19                 :            : #define _IMP_LOCK_HELD_METHODDEF    \
      20                 :            :     {"lock_held", (PyCFunction)_imp_lock_held, METH_NOARGS, _imp_lock_held__doc__},
      21                 :            : 
      22                 :            : static PyObject *
      23                 :            : _imp_lock_held_impl(PyObject *module);
      24                 :            : 
      25                 :            : static PyObject *
      26                 :          0 : _imp_lock_held(PyObject *module, PyObject *Py_UNUSED(ignored))
      27                 :            : {
      28                 :          0 :     return _imp_lock_held_impl(module);
      29                 :            : }
      30                 :            : 
      31                 :            : PyDoc_STRVAR(_imp_acquire_lock__doc__,
      32                 :            : "acquire_lock($module, /)\n"
      33                 :            : "--\n"
      34                 :            : "\n"
      35                 :            : "Acquires the interpreter\'s import lock for the current thread.\n"
      36                 :            : "\n"
      37                 :            : "This lock should be used by import hooks to ensure thread-safety when importing\n"
      38                 :            : "modules. On platforms without threads, this function does nothing.");
      39                 :            : 
      40                 :            : #define _IMP_ACQUIRE_LOCK_METHODDEF    \
      41                 :            :     {"acquire_lock", (PyCFunction)_imp_acquire_lock, METH_NOARGS, _imp_acquire_lock__doc__},
      42                 :            : 
      43                 :            : static PyObject *
      44                 :            : _imp_acquire_lock_impl(PyObject *module);
      45                 :            : 
      46                 :            : static PyObject *
      47                 :       4609 : _imp_acquire_lock(PyObject *module, PyObject *Py_UNUSED(ignored))
      48                 :            : {
      49                 :       4609 :     return _imp_acquire_lock_impl(module);
      50                 :            : }
      51                 :            : 
      52                 :            : PyDoc_STRVAR(_imp_release_lock__doc__,
      53                 :            : "release_lock($module, /)\n"
      54                 :            : "--\n"
      55                 :            : "\n"
      56                 :            : "Release the interpreter\'s import lock.\n"
      57                 :            : "\n"
      58                 :            : "On platforms without threads, this function does nothing.");
      59                 :            : 
      60                 :            : #define _IMP_RELEASE_LOCK_METHODDEF    \
      61                 :            :     {"release_lock", (PyCFunction)_imp_release_lock, METH_NOARGS, _imp_release_lock__doc__},
      62                 :            : 
      63                 :            : static PyObject *
      64                 :            : _imp_release_lock_impl(PyObject *module);
      65                 :            : 
      66                 :            : static PyObject *
      67                 :       4609 : _imp_release_lock(PyObject *module, PyObject *Py_UNUSED(ignored))
      68                 :            : {
      69                 :       4609 :     return _imp_release_lock_impl(module);
      70                 :            : }
      71                 :            : 
      72                 :            : PyDoc_STRVAR(_imp__fix_co_filename__doc__,
      73                 :            : "_fix_co_filename($module, code, path, /)\n"
      74                 :            : "--\n"
      75                 :            : "\n"
      76                 :            : "Changes code.co_filename to specify the passed-in file path.\n"
      77                 :            : "\n"
      78                 :            : "  code\n"
      79                 :            : "    Code object to change.\n"
      80                 :            : "  path\n"
      81                 :            : "    File path to use.");
      82                 :            : 
      83                 :            : #define _IMP__FIX_CO_FILENAME_METHODDEF    \
      84                 :            :     {"_fix_co_filename", _PyCFunction_CAST(_imp__fix_co_filename), METH_FASTCALL, _imp__fix_co_filename__doc__},
      85                 :            : 
      86                 :            : static PyObject *
      87                 :            : _imp__fix_co_filename_impl(PyObject *module, PyCodeObject *code,
      88                 :            :                            PyObject *path);
      89                 :            : 
      90                 :            : static PyObject *
      91                 :        386 : _imp__fix_co_filename(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
      92                 :            : {
      93                 :        386 :     PyObject *return_value = NULL;
      94                 :            :     PyCodeObject *code;
      95                 :            :     PyObject *path;
      96                 :            : 
      97   [ +  -  -  +  :        386 :     if (!_PyArg_CheckPositional("_fix_co_filename", nargs, 2, 2)) {
                   -  - ]
      98                 :          0 :         goto exit;
      99                 :            :     }
     100         [ -  + ]:        386 :     if (!PyObject_TypeCheck(args[0], &PyCode_Type)) {
     101                 :          0 :         _PyArg_BadArgument("_fix_co_filename", "argument 1", (&PyCode_Type)->tp_name, args[0]);
     102                 :          0 :         goto exit;
     103                 :            :     }
     104                 :        386 :     code = (PyCodeObject *)args[0];
     105         [ -  + ]:        386 :     if (!PyUnicode_Check(args[1])) {
     106                 :          0 :         _PyArg_BadArgument("_fix_co_filename", "argument 2", "str", args[1]);
     107                 :          0 :         goto exit;
     108                 :            :     }
     109         [ -  + ]:        386 :     if (PyUnicode_READY(args[1]) == -1) {
     110                 :          0 :         goto exit;
     111                 :            :     }
     112                 :        386 :     path = args[1];
     113                 :        386 :     return_value = _imp__fix_co_filename_impl(module, code, path);
     114                 :            : 
     115                 :        386 : exit:
     116                 :        386 :     return return_value;
     117                 :            : }
     118                 :            : 
     119                 :            : PyDoc_STRVAR(_imp_create_builtin__doc__,
     120                 :            : "create_builtin($module, spec, /)\n"
     121                 :            : "--\n"
     122                 :            : "\n"
     123                 :            : "Create an extension module.");
     124                 :            : 
     125                 :            : #define _IMP_CREATE_BUILTIN_METHODDEF    \
     126                 :            :     {"create_builtin", (PyCFunction)_imp_create_builtin, METH_O, _imp_create_builtin__doc__},
     127                 :            : 
     128                 :            : PyDoc_STRVAR(_imp_extension_suffixes__doc__,
     129                 :            : "extension_suffixes($module, /)\n"
     130                 :            : "--\n"
     131                 :            : "\n"
     132                 :            : "Returns the list of file suffixes used to identify extension modules.");
     133                 :            : 
     134                 :            : #define _IMP_EXTENSION_SUFFIXES_METHODDEF    \
     135                 :            :     {"extension_suffixes", (PyCFunction)_imp_extension_suffixes, METH_NOARGS, _imp_extension_suffixes__doc__},
     136                 :            : 
     137                 :            : static PyObject *
     138                 :            : _imp_extension_suffixes_impl(PyObject *module);
     139                 :            : 
     140                 :            : static PyObject *
     141                 :         50 : _imp_extension_suffixes(PyObject *module, PyObject *Py_UNUSED(ignored))
     142                 :            : {
     143                 :         50 :     return _imp_extension_suffixes_impl(module);
     144                 :            : }
     145                 :            : 
     146                 :            : PyDoc_STRVAR(_imp_init_frozen__doc__,
     147                 :            : "init_frozen($module, name, /)\n"
     148                 :            : "--\n"
     149                 :            : "\n"
     150                 :            : "Initializes a frozen module.");
     151                 :            : 
     152                 :            : #define _IMP_INIT_FROZEN_METHODDEF    \
     153                 :            :     {"init_frozen", (PyCFunction)_imp_init_frozen, METH_O, _imp_init_frozen__doc__},
     154                 :            : 
     155                 :            : static PyObject *
     156                 :            : _imp_init_frozen_impl(PyObject *module, PyObject *name);
     157                 :            : 
     158                 :            : static PyObject *
     159                 :          0 : _imp_init_frozen(PyObject *module, PyObject *arg)
     160                 :            : {
     161                 :          0 :     PyObject *return_value = NULL;
     162                 :            :     PyObject *name;
     163                 :            : 
     164         [ #  # ]:          0 :     if (!PyUnicode_Check(arg)) {
     165                 :          0 :         _PyArg_BadArgument("init_frozen", "argument", "str", arg);
     166                 :          0 :         goto exit;
     167                 :            :     }
     168         [ #  # ]:          0 :     if (PyUnicode_READY(arg) == -1) {
     169                 :          0 :         goto exit;
     170                 :            :     }
     171                 :          0 :     name = arg;
     172                 :          0 :     return_value = _imp_init_frozen_impl(module, name);
     173                 :            : 
     174                 :          0 : exit:
     175                 :          0 :     return return_value;
     176                 :            : }
     177                 :            : 
     178                 :            : PyDoc_STRVAR(_imp_find_frozen__doc__,
     179                 :            : "find_frozen($module, name, /, *, withdata=False)\n"
     180                 :            : "--\n"
     181                 :            : "\n"
     182                 :            : "Return info about the corresponding frozen module (if there is one) or None.\n"
     183                 :            : "\n"
     184                 :            : "The returned info (a 2-tuple):\n"
     185                 :            : "\n"
     186                 :            : " * data         the raw marshalled bytes\n"
     187                 :            : " * is_package   whether or not it is a package\n"
     188                 :            : " * origname     the originally frozen module\'s name, or None if not\n"
     189                 :            : "                a stdlib module (this will usually be the same as\n"
     190                 :            : "                the module\'s current name)");
     191                 :            : 
     192                 :            : #define _IMP_FIND_FROZEN_METHODDEF    \
     193                 :            :     {"find_frozen", _PyCFunction_CAST(_imp_find_frozen), METH_FASTCALL|METH_KEYWORDS, _imp_find_frozen__doc__},
     194                 :            : 
     195                 :            : static PyObject *
     196                 :            : _imp_find_frozen_impl(PyObject *module, PyObject *name, int withdata);
     197                 :            : 
     198                 :            : static PyObject *
     199                 :        720 : _imp_find_frozen(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
     200                 :            : {
     201                 :        720 :     PyObject *return_value = NULL;
     202                 :            :     #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
     203                 :            : 
     204                 :            :     #define NUM_KEYWORDS 1
     205                 :            :     static struct {
     206                 :            :         PyGC_Head _this_is_not_used;
     207                 :            :         PyObject_VAR_HEAD
     208                 :            :         PyObject *ob_item[NUM_KEYWORDS];
     209                 :            :     } _kwtuple = {
     210                 :            :         .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
     211                 :            :         .ob_item = { &_Py_ID(withdata), },
     212                 :            :     };
     213                 :            :     #undef NUM_KEYWORDS
     214                 :            :     #define KWTUPLE (&_kwtuple.ob_base.ob_base)
     215                 :            : 
     216                 :            :     #else  // !Py_BUILD_CORE
     217                 :            :     #  define KWTUPLE NULL
     218                 :            :     #endif  // !Py_BUILD_CORE
     219                 :            : 
     220                 :            :     static const char * const _keywords[] = {"", "withdata", NULL};
     221                 :            :     static _PyArg_Parser _parser = {
     222                 :            :         .keywords = _keywords,
     223                 :            :         .fname = "find_frozen",
     224                 :            :         .kwtuple = KWTUPLE,
     225                 :            :     };
     226                 :            :     #undef KWTUPLE
     227                 :            :     PyObject *argsbuf[2];
     228         [ -  + ]:        720 :     Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
     229                 :            :     PyObject *name;
     230                 :        720 :     int withdata = 0;
     231                 :            : 
     232   [ +  -  +  -  :        720 :     args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
             +  -  -  + ]
     233         [ -  + ]:        720 :     if (!args) {
     234                 :          0 :         goto exit;
     235                 :            :     }
     236         [ -  + ]:        720 :     if (!PyUnicode_Check(args[0])) {
     237                 :          0 :         _PyArg_BadArgument("find_frozen", "argument 1", "str", args[0]);
     238                 :          0 :         goto exit;
     239                 :            :     }
     240         [ -  + ]:        720 :     if (PyUnicode_READY(args[0]) == -1) {
     241                 :          0 :         goto exit;
     242                 :            :     }
     243                 :        720 :     name = args[0];
     244         [ +  - ]:        720 :     if (!noptargs) {
     245                 :        720 :         goto skip_optional_kwonly;
     246                 :            :     }
     247                 :          0 :     withdata = PyObject_IsTrue(args[1]);
     248         [ #  # ]:          0 :     if (withdata < 0) {
     249                 :          0 :         goto exit;
     250                 :            :     }
     251                 :          0 : skip_optional_kwonly:
     252                 :        720 :     return_value = _imp_find_frozen_impl(module, name, withdata);
     253                 :            : 
     254                 :        720 : exit:
     255                 :        720 :     return return_value;
     256                 :            : }
     257                 :            : 
     258                 :            : PyDoc_STRVAR(_imp_get_frozen_object__doc__,
     259                 :            : "get_frozen_object($module, name, data=None, /)\n"
     260                 :            : "--\n"
     261                 :            : "\n"
     262                 :            : "Create a code object for a frozen module.");
     263                 :            : 
     264                 :            : #define _IMP_GET_FROZEN_OBJECT_METHODDEF    \
     265                 :            :     {"get_frozen_object", _PyCFunction_CAST(_imp_get_frozen_object), METH_FASTCALL, _imp_get_frozen_object__doc__},
     266                 :            : 
     267                 :            : static PyObject *
     268                 :            : _imp_get_frozen_object_impl(PyObject *module, PyObject *name,
     269                 :            :                             PyObject *dataobj);
     270                 :            : 
     271                 :            : static PyObject *
     272                 :         97 : _imp_get_frozen_object(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
     273                 :            : {
     274                 :         97 :     PyObject *return_value = NULL;
     275                 :            :     PyObject *name;
     276                 :         97 :     PyObject *dataobj = Py_None;
     277                 :            : 
     278   [ +  -  -  +  :         97 :     if (!_PyArg_CheckPositional("get_frozen_object", nargs, 1, 2)) {
                   -  - ]
     279                 :          0 :         goto exit;
     280                 :            :     }
     281         [ -  + ]:         97 :     if (!PyUnicode_Check(args[0])) {
     282                 :          0 :         _PyArg_BadArgument("get_frozen_object", "argument 1", "str", args[0]);
     283                 :          0 :         goto exit;
     284                 :            :     }
     285         [ -  + ]:         97 :     if (PyUnicode_READY(args[0]) == -1) {
     286                 :          0 :         goto exit;
     287                 :            :     }
     288                 :         97 :     name = args[0];
     289         [ +  - ]:         97 :     if (nargs < 2) {
     290                 :         97 :         goto skip_optional;
     291                 :            :     }
     292                 :          0 :     dataobj = args[1];
     293                 :         97 : skip_optional:
     294                 :         97 :     return_value = _imp_get_frozen_object_impl(module, name, dataobj);
     295                 :            : 
     296                 :         97 : exit:
     297                 :         97 :     return return_value;
     298                 :            : }
     299                 :            : 
     300                 :            : PyDoc_STRVAR(_imp_is_frozen_package__doc__,
     301                 :            : "is_frozen_package($module, name, /)\n"
     302                 :            : "--\n"
     303                 :            : "\n"
     304                 :            : "Returns True if the module name is of a frozen package.");
     305                 :            : 
     306                 :            : #define _IMP_IS_FROZEN_PACKAGE_METHODDEF    \
     307                 :            :     {"is_frozen_package", (PyCFunction)_imp_is_frozen_package, METH_O, _imp_is_frozen_package__doc__},
     308                 :            : 
     309                 :            : static PyObject *
     310                 :            : _imp_is_frozen_package_impl(PyObject *module, PyObject *name);
     311                 :            : 
     312                 :            : static PyObject *
     313                 :         25 : _imp_is_frozen_package(PyObject *module, PyObject *arg)
     314                 :            : {
     315                 :         25 :     PyObject *return_value = NULL;
     316                 :            :     PyObject *name;
     317                 :            : 
     318         [ -  + ]:         25 :     if (!PyUnicode_Check(arg)) {
     319                 :          0 :         _PyArg_BadArgument("is_frozen_package", "argument", "str", arg);
     320                 :          0 :         goto exit;
     321                 :            :     }
     322         [ -  + ]:         25 :     if (PyUnicode_READY(arg) == -1) {
     323                 :          0 :         goto exit;
     324                 :            :     }
     325                 :         25 :     name = arg;
     326                 :         25 :     return_value = _imp_is_frozen_package_impl(module, name);
     327                 :            : 
     328                 :         25 : exit:
     329                 :         25 :     return return_value;
     330                 :            : }
     331                 :            : 
     332                 :            : PyDoc_STRVAR(_imp_is_builtin__doc__,
     333                 :            : "is_builtin($module, name, /)\n"
     334                 :            : "--\n"
     335                 :            : "\n"
     336                 :            : "Returns True if the module name corresponds to a built-in module.");
     337                 :            : 
     338                 :            : #define _IMP_IS_BUILTIN_METHODDEF    \
     339                 :            :     {"is_builtin", (PyCFunction)_imp_is_builtin, METH_O, _imp_is_builtin__doc__},
     340                 :            : 
     341                 :            : static PyObject *
     342                 :            : _imp_is_builtin_impl(PyObject *module, PyObject *name);
     343                 :            : 
     344                 :            : static PyObject *
     345                 :        875 : _imp_is_builtin(PyObject *module, PyObject *arg)
     346                 :            : {
     347                 :        875 :     PyObject *return_value = NULL;
     348                 :            :     PyObject *name;
     349                 :            : 
     350         [ -  + ]:        875 :     if (!PyUnicode_Check(arg)) {
     351                 :          0 :         _PyArg_BadArgument("is_builtin", "argument", "str", arg);
     352                 :          0 :         goto exit;
     353                 :            :     }
     354         [ -  + ]:        875 :     if (PyUnicode_READY(arg) == -1) {
     355                 :          0 :         goto exit;
     356                 :            :     }
     357                 :        875 :     name = arg;
     358                 :        875 :     return_value = _imp_is_builtin_impl(module, name);
     359                 :            : 
     360                 :        875 : exit:
     361                 :        875 :     return return_value;
     362                 :            : }
     363                 :            : 
     364                 :            : PyDoc_STRVAR(_imp_is_frozen__doc__,
     365                 :            : "is_frozen($module, name, /)\n"
     366                 :            : "--\n"
     367                 :            : "\n"
     368                 :            : "Returns True if the module name corresponds to a frozen module.");
     369                 :            : 
     370                 :            : #define _IMP_IS_FROZEN_METHODDEF    \
     371                 :            :     {"is_frozen", (PyCFunction)_imp_is_frozen, METH_O, _imp_is_frozen__doc__},
     372                 :            : 
     373                 :            : static PyObject *
     374                 :            : _imp_is_frozen_impl(PyObject *module, PyObject *name);
     375                 :            : 
     376                 :            : static PyObject *
     377                 :         25 : _imp_is_frozen(PyObject *module, PyObject *arg)
     378                 :            : {
     379                 :         25 :     PyObject *return_value = NULL;
     380                 :            :     PyObject *name;
     381                 :            : 
     382         [ -  + ]:         25 :     if (!PyUnicode_Check(arg)) {
     383                 :          0 :         _PyArg_BadArgument("is_frozen", "argument", "str", arg);
     384                 :          0 :         goto exit;
     385                 :            :     }
     386         [ -  + ]:         25 :     if (PyUnicode_READY(arg) == -1) {
     387                 :          0 :         goto exit;
     388                 :            :     }
     389                 :         25 :     name = arg;
     390                 :         25 :     return_value = _imp_is_frozen_impl(module, name);
     391                 :            : 
     392                 :         25 : exit:
     393                 :         25 :     return return_value;
     394                 :            : }
     395                 :            : 
     396                 :            : PyDoc_STRVAR(_imp__frozen_module_names__doc__,
     397                 :            : "_frozen_module_names($module, /)\n"
     398                 :            : "--\n"
     399                 :            : "\n"
     400                 :            : "Returns the list of available frozen modules.");
     401                 :            : 
     402                 :            : #define _IMP__FROZEN_MODULE_NAMES_METHODDEF    \
     403                 :            :     {"_frozen_module_names", (PyCFunction)_imp__frozen_module_names, METH_NOARGS, _imp__frozen_module_names__doc__},
     404                 :            : 
     405                 :            : static PyObject *
     406                 :            : _imp__frozen_module_names_impl(PyObject *module);
     407                 :            : 
     408                 :            : static PyObject *
     409                 :          0 : _imp__frozen_module_names(PyObject *module, PyObject *Py_UNUSED(ignored))
     410                 :            : {
     411                 :          0 :     return _imp__frozen_module_names_impl(module);
     412                 :            : }
     413                 :            : 
     414                 :            : PyDoc_STRVAR(_imp__override_frozen_modules_for_tests__doc__,
     415                 :            : "_override_frozen_modules_for_tests($module, override, /)\n"
     416                 :            : "--\n"
     417                 :            : "\n"
     418                 :            : "(internal-only) Override PyConfig.use_frozen_modules.\n"
     419                 :            : "\n"
     420                 :            : "(-1: \"off\", 1: \"on\", 0: no override)\n"
     421                 :            : "See frozen_modules() in Lib/test/support/import_helper.py.");
     422                 :            : 
     423                 :            : #define _IMP__OVERRIDE_FROZEN_MODULES_FOR_TESTS_METHODDEF    \
     424                 :            :     {"_override_frozen_modules_for_tests", (PyCFunction)_imp__override_frozen_modules_for_tests, METH_O, _imp__override_frozen_modules_for_tests__doc__},
     425                 :            : 
     426                 :            : static PyObject *
     427                 :            : _imp__override_frozen_modules_for_tests_impl(PyObject *module, int override);
     428                 :            : 
     429                 :            : static PyObject *
     430                 :          0 : _imp__override_frozen_modules_for_tests(PyObject *module, PyObject *arg)
     431                 :            : {
     432                 :          0 :     PyObject *return_value = NULL;
     433                 :            :     int override;
     434                 :            : 
     435                 :          0 :     override = _PyLong_AsInt(arg);
     436   [ #  #  #  # ]:          0 :     if (override == -1 && PyErr_Occurred()) {
     437                 :          0 :         goto exit;
     438                 :            :     }
     439                 :          0 :     return_value = _imp__override_frozen_modules_for_tests_impl(module, override);
     440                 :            : 
     441                 :          0 : exit:
     442                 :          0 :     return return_value;
     443                 :            : }
     444                 :            : 
     445                 :            : PyDoc_STRVAR(_imp__override_multi_interp_extensions_check__doc__,
     446                 :            : "_override_multi_interp_extensions_check($module, override, /)\n"
     447                 :            : "--\n"
     448                 :            : "\n"
     449                 :            : "(internal-only) Override PyInterpreterConfig.check_multi_interp_extensions.\n"
     450                 :            : "\n"
     451                 :            : "(-1: \"never\", 1: \"always\", 0: no override)");
     452                 :            : 
     453                 :            : #define _IMP__OVERRIDE_MULTI_INTERP_EXTENSIONS_CHECK_METHODDEF    \
     454                 :            :     {"_override_multi_interp_extensions_check", (PyCFunction)_imp__override_multi_interp_extensions_check, METH_O, _imp__override_multi_interp_extensions_check__doc__},
     455                 :            : 
     456                 :            : static PyObject *
     457                 :            : _imp__override_multi_interp_extensions_check_impl(PyObject *module,
     458                 :            :                                                   int override);
     459                 :            : 
     460                 :            : static PyObject *
     461                 :          0 : _imp__override_multi_interp_extensions_check(PyObject *module, PyObject *arg)
     462                 :            : {
     463                 :          0 :     PyObject *return_value = NULL;
     464                 :            :     int override;
     465                 :            : 
     466                 :          0 :     override = _PyLong_AsInt(arg);
     467   [ #  #  #  # ]:          0 :     if (override == -1 && PyErr_Occurred()) {
     468                 :          0 :         goto exit;
     469                 :            :     }
     470                 :          0 :     return_value = _imp__override_multi_interp_extensions_check_impl(module, override);
     471                 :            : 
     472                 :          0 : exit:
     473                 :          0 :     return return_value;
     474                 :            : }
     475                 :            : 
     476                 :            : #if defined(HAVE_DYNAMIC_LOADING)
     477                 :            : 
     478                 :            : PyDoc_STRVAR(_imp_create_dynamic__doc__,
     479                 :            : "create_dynamic($module, spec, file=<unrepresentable>, /)\n"
     480                 :            : "--\n"
     481                 :            : "\n"
     482                 :            : "Create an extension module.");
     483                 :            : 
     484                 :            : #define _IMP_CREATE_DYNAMIC_METHODDEF    \
     485                 :            :     {"create_dynamic", _PyCFunction_CAST(_imp_create_dynamic), METH_FASTCALL, _imp_create_dynamic__doc__},
     486                 :            : 
     487                 :            : static PyObject *
     488                 :            : _imp_create_dynamic_impl(PyObject *module, PyObject *spec, PyObject *file);
     489                 :            : 
     490                 :            : static PyObject *
     491                 :        115 : _imp_create_dynamic(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
     492                 :            : {
     493                 :        115 :     PyObject *return_value = NULL;
     494                 :            :     PyObject *spec;
     495                 :        115 :     PyObject *file = NULL;
     496                 :            : 
     497   [ +  -  -  +  :        115 :     if (!_PyArg_CheckPositional("create_dynamic", nargs, 1, 2)) {
                   -  - ]
     498                 :          0 :         goto exit;
     499                 :            :     }
     500                 :        115 :     spec = args[0];
     501         [ +  - ]:        115 :     if (nargs < 2) {
     502                 :        115 :         goto skip_optional;
     503                 :            :     }
     504                 :          0 :     file = args[1];
     505                 :        115 : skip_optional:
     506                 :        115 :     return_value = _imp_create_dynamic_impl(module, spec, file);
     507                 :            : 
     508                 :        115 : exit:
     509                 :        115 :     return return_value;
     510                 :            : }
     511                 :            : 
     512                 :            : #endif /* defined(HAVE_DYNAMIC_LOADING) */
     513                 :            : 
     514                 :            : #if defined(HAVE_DYNAMIC_LOADING)
     515                 :            : 
     516                 :            : PyDoc_STRVAR(_imp_exec_dynamic__doc__,
     517                 :            : "exec_dynamic($module, mod, /)\n"
     518                 :            : "--\n"
     519                 :            : "\n"
     520                 :            : "Initialize an extension module.");
     521                 :            : 
     522                 :            : #define _IMP_EXEC_DYNAMIC_METHODDEF    \
     523                 :            :     {"exec_dynamic", (PyCFunction)_imp_exec_dynamic, METH_O, _imp_exec_dynamic__doc__},
     524                 :            : 
     525                 :            : static int
     526                 :            : _imp_exec_dynamic_impl(PyObject *module, PyObject *mod);
     527                 :            : 
     528                 :            : static PyObject *
     529                 :        115 : _imp_exec_dynamic(PyObject *module, PyObject *mod)
     530                 :            : {
     531                 :        115 :     PyObject *return_value = NULL;
     532                 :            :     int _return_value;
     533                 :            : 
     534                 :        115 :     _return_value = _imp_exec_dynamic_impl(module, mod);
     535   [ -  +  -  - ]:        115 :     if ((_return_value == -1) && PyErr_Occurred()) {
     536                 :          0 :         goto exit;
     537                 :            :     }
     538                 :        115 :     return_value = PyLong_FromLong((long)_return_value);
     539                 :            : 
     540                 :        115 : exit:
     541                 :        115 :     return return_value;
     542                 :            : }
     543                 :            : 
     544                 :            : #endif /* defined(HAVE_DYNAMIC_LOADING) */
     545                 :            : 
     546                 :            : PyDoc_STRVAR(_imp_exec_builtin__doc__,
     547                 :            : "exec_builtin($module, mod, /)\n"
     548                 :            : "--\n"
     549                 :            : "\n"
     550                 :            : "Initialize a built-in module.");
     551                 :            : 
     552                 :            : #define _IMP_EXEC_BUILTIN_METHODDEF    \
     553                 :            :     {"exec_builtin", (PyCFunction)_imp_exec_builtin, METH_O, _imp_exec_builtin__doc__},
     554                 :            : 
     555                 :            : static int
     556                 :            : _imp_exec_builtin_impl(PyObject *module, PyObject *mod);
     557                 :            : 
     558                 :            : static PyObject *
     559                 :        323 : _imp_exec_builtin(PyObject *module, PyObject *mod)
     560                 :            : {
     561                 :        323 :     PyObject *return_value = NULL;
     562                 :            :     int _return_value;
     563                 :            : 
     564                 :        323 :     _return_value = _imp_exec_builtin_impl(module, mod);
     565   [ -  +  -  - ]:        323 :     if ((_return_value == -1) && PyErr_Occurred()) {
     566                 :          0 :         goto exit;
     567                 :            :     }
     568                 :        323 :     return_value = PyLong_FromLong((long)_return_value);
     569                 :            : 
     570                 :        323 : exit:
     571                 :        323 :     return return_value;
     572                 :            : }
     573                 :            : 
     574                 :            : PyDoc_STRVAR(_imp_source_hash__doc__,
     575                 :            : "source_hash($module, /, key, source)\n"
     576                 :            : "--\n"
     577                 :            : "\n");
     578                 :            : 
     579                 :            : #define _IMP_SOURCE_HASH_METHODDEF    \
     580                 :            :     {"source_hash", _PyCFunction_CAST(_imp_source_hash), METH_FASTCALL|METH_KEYWORDS, _imp_source_hash__doc__},
     581                 :            : 
     582                 :            : static PyObject *
     583                 :            : _imp_source_hash_impl(PyObject *module, long key, Py_buffer *source);
     584                 :            : 
     585                 :            : static PyObject *
     586                 :          0 : _imp_source_hash(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
     587                 :            : {
     588                 :          0 :     PyObject *return_value = NULL;
     589                 :            :     #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
     590                 :            : 
     591                 :            :     #define NUM_KEYWORDS 2
     592                 :            :     static struct {
     593                 :            :         PyGC_Head _this_is_not_used;
     594                 :            :         PyObject_VAR_HEAD
     595                 :            :         PyObject *ob_item[NUM_KEYWORDS];
     596                 :            :     } _kwtuple = {
     597                 :            :         .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
     598                 :            :         .ob_item = { &_Py_ID(key), &_Py_ID(source), },
     599                 :            :     };
     600                 :            :     #undef NUM_KEYWORDS
     601                 :            :     #define KWTUPLE (&_kwtuple.ob_base.ob_base)
     602                 :            : 
     603                 :            :     #else  // !Py_BUILD_CORE
     604                 :            :     #  define KWTUPLE NULL
     605                 :            :     #endif  // !Py_BUILD_CORE
     606                 :            : 
     607                 :            :     static const char * const _keywords[] = {"key", "source", NULL};
     608                 :            :     static _PyArg_Parser _parser = {
     609                 :            :         .keywords = _keywords,
     610                 :            :         .fname = "source_hash",
     611                 :            :         .kwtuple = KWTUPLE,
     612                 :            :     };
     613                 :            :     #undef KWTUPLE
     614                 :            :     PyObject *argsbuf[2];
     615                 :            :     long key;
     616                 :          0 :     Py_buffer source = {NULL, NULL};
     617                 :            : 
     618   [ #  #  #  #  :          0 :     args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 0, argsbuf);
             #  #  #  # ]
     619         [ #  # ]:          0 :     if (!args) {
     620                 :          0 :         goto exit;
     621                 :            :     }
     622                 :          0 :     key = PyLong_AsLong(args[0]);
     623   [ #  #  #  # ]:          0 :     if (key == -1 && PyErr_Occurred()) {
     624                 :          0 :         goto exit;
     625                 :            :     }
     626         [ #  # ]:          0 :     if (PyObject_GetBuffer(args[1], &source, PyBUF_SIMPLE) != 0) {
     627                 :          0 :         goto exit;
     628                 :            :     }
     629         [ #  # ]:          0 :     if (!PyBuffer_IsContiguous(&source, 'C')) {
     630                 :          0 :         _PyArg_BadArgument("source_hash", "argument 'source'", "contiguous buffer", args[1]);
     631                 :          0 :         goto exit;
     632                 :            :     }
     633                 :          0 :     return_value = _imp_source_hash_impl(module, key, &source);
     634                 :            : 
     635                 :          0 : exit:
     636                 :            :     /* Cleanup for source */
     637         [ #  # ]:          0 :     if (source.obj) {
     638                 :          0 :        PyBuffer_Release(&source);
     639                 :            :     }
     640                 :            : 
     641                 :          0 :     return return_value;
     642                 :            : }
     643                 :            : 
     644                 :            : #ifndef _IMP_CREATE_DYNAMIC_METHODDEF
     645                 :            :     #define _IMP_CREATE_DYNAMIC_METHODDEF
     646                 :            : #endif /* !defined(_IMP_CREATE_DYNAMIC_METHODDEF) */
     647                 :            : 
     648                 :            : #ifndef _IMP_EXEC_DYNAMIC_METHODDEF
     649                 :            :     #define _IMP_EXEC_DYNAMIC_METHODDEF
     650                 :            : #endif /* !defined(_IMP_EXEC_DYNAMIC_METHODDEF) */
     651                 :            : /*[clinic end generated code: output=b18d46e0036eff49 input=a9049054013a1b77]*/

Generated by: LCOV version 1.14