Home | History | Annotate | Download | only in clinic
      1 /*[clinic input]
      2 preserve
      3 [clinic start generated code]*/
      4 
      5 PyDoc_STRVAR(_imp_lock_held__doc__,
      6 "lock_held($module, /)\n"
      7 "--\n"
      8 "\n"
      9 "Return True if the import lock is currently held, else False.\n"
     10 "\n"
     11 "On platforms without threads, return False.");
     12 
     13 #define _IMP_LOCK_HELD_METHODDEF    \
     14     {"lock_held", (PyCFunction)_imp_lock_held, METH_NOARGS, _imp_lock_held__doc__},
     15 
     16 static PyObject *
     17 _imp_lock_held_impl(PyObject *module);
     18 
     19 static PyObject *
     20 _imp_lock_held(PyObject *module, PyObject *Py_UNUSED(ignored))
     21 {
     22     return _imp_lock_held_impl(module);
     23 }
     24 
     25 PyDoc_STRVAR(_imp_acquire_lock__doc__,
     26 "acquire_lock($module, /)\n"
     27 "--\n"
     28 "\n"
     29 "Acquires the interpreter\'s import lock for the current thread.\n"
     30 "\n"
     31 "This lock should be used by import hooks to ensure thread-safety when importing\n"
     32 "modules. On platforms without threads, this function does nothing.");
     33 
     34 #define _IMP_ACQUIRE_LOCK_METHODDEF    \
     35     {"acquire_lock", (PyCFunction)_imp_acquire_lock, METH_NOARGS, _imp_acquire_lock__doc__},
     36 
     37 static PyObject *
     38 _imp_acquire_lock_impl(PyObject *module);
     39 
     40 static PyObject *
     41 _imp_acquire_lock(PyObject *module, PyObject *Py_UNUSED(ignored))
     42 {
     43     return _imp_acquire_lock_impl(module);
     44 }
     45 
     46 PyDoc_STRVAR(_imp_release_lock__doc__,
     47 "release_lock($module, /)\n"
     48 "--\n"
     49 "\n"
     50 "Release the interpreter\'s import lock.\n"
     51 "\n"
     52 "On platforms without threads, this function does nothing.");
     53 
     54 #define _IMP_RELEASE_LOCK_METHODDEF    \
     55     {"release_lock", (PyCFunction)_imp_release_lock, METH_NOARGS, _imp_release_lock__doc__},
     56 
     57 static PyObject *
     58 _imp_release_lock_impl(PyObject *module);
     59 
     60 static PyObject *
     61 _imp_release_lock(PyObject *module, PyObject *Py_UNUSED(ignored))
     62 {
     63     return _imp_release_lock_impl(module);
     64 }
     65 
     66 PyDoc_STRVAR(_imp__fix_co_filename__doc__,
     67 "_fix_co_filename($module, code, path, /)\n"
     68 "--\n"
     69 "\n"
     70 "Changes code.co_filename to specify the passed-in file path.\n"
     71 "\n"
     72 "  code\n"
     73 "    Code object to change.\n"
     74 "  path\n"
     75 "    File path to use.");
     76 
     77 #define _IMP__FIX_CO_FILENAME_METHODDEF    \
     78     {"_fix_co_filename", (PyCFunction)_imp__fix_co_filename, METH_VARARGS, _imp__fix_co_filename__doc__},
     79 
     80 static PyObject *
     81 _imp__fix_co_filename_impl(PyObject *module, PyCodeObject *code,
     82                            PyObject *path);
     83 
     84 static PyObject *
     85 _imp__fix_co_filename(PyObject *module, PyObject *args)
     86 {
     87     PyObject *return_value = NULL;
     88     PyCodeObject *code;
     89     PyObject *path;
     90 
     91     if (!PyArg_ParseTuple(args, "O!U:_fix_co_filename",
     92         &PyCode_Type, &code, &path)) {
     93         goto exit;
     94     }
     95     return_value = _imp__fix_co_filename_impl(module, code, path);
     96 
     97 exit:
     98     return return_value;
     99 }
    100 
    101 PyDoc_STRVAR(_imp_create_builtin__doc__,
    102 "create_builtin($module, spec, /)\n"
    103 "--\n"
    104 "\n"
    105 "Create an extension module.");
    106 
    107 #define _IMP_CREATE_BUILTIN_METHODDEF    \
    108     {"create_builtin", (PyCFunction)_imp_create_builtin, METH_O, _imp_create_builtin__doc__},
    109 
    110 PyDoc_STRVAR(_imp_extension_suffixes__doc__,
    111 "extension_suffixes($module, /)\n"
    112 "--\n"
    113 "\n"
    114 "Returns the list of file suffixes used to identify extension modules.");
    115 
    116 #define _IMP_EXTENSION_SUFFIXES_METHODDEF    \
    117     {"extension_suffixes", (PyCFunction)_imp_extension_suffixes, METH_NOARGS, _imp_extension_suffixes__doc__},
    118 
    119 static PyObject *
    120 _imp_extension_suffixes_impl(PyObject *module);
    121 
    122 static PyObject *
    123 _imp_extension_suffixes(PyObject *module, PyObject *Py_UNUSED(ignored))
    124 {
    125     return _imp_extension_suffixes_impl(module);
    126 }
    127 
    128 PyDoc_STRVAR(_imp_init_frozen__doc__,
    129 "init_frozen($module, name, /)\n"
    130 "--\n"
    131 "\n"
    132 "Initializes a frozen module.");
    133 
    134 #define _IMP_INIT_FROZEN_METHODDEF    \
    135     {"init_frozen", (PyCFunction)_imp_init_frozen, METH_O, _imp_init_frozen__doc__},
    136 
    137 static PyObject *
    138 _imp_init_frozen_impl(PyObject *module, PyObject *name);
    139 
    140 static PyObject *
    141 _imp_init_frozen(PyObject *module, PyObject *arg)
    142 {
    143     PyObject *return_value = NULL;
    144     PyObject *name;
    145 
    146     if (!PyArg_Parse(arg, "U:init_frozen", &name)) {
    147         goto exit;
    148     }
    149     return_value = _imp_init_frozen_impl(module, name);
    150 
    151 exit:
    152     return return_value;
    153 }
    154 
    155 PyDoc_STRVAR(_imp_get_frozen_object__doc__,
    156 "get_frozen_object($module, name, /)\n"
    157 "--\n"
    158 "\n"
    159 "Create a code object for a frozen module.");
    160 
    161 #define _IMP_GET_FROZEN_OBJECT_METHODDEF    \
    162     {"get_frozen_object", (PyCFunction)_imp_get_frozen_object, METH_O, _imp_get_frozen_object__doc__},
    163 
    164 static PyObject *
    165 _imp_get_frozen_object_impl(PyObject *module, PyObject *name);
    166 
    167 static PyObject *
    168 _imp_get_frozen_object(PyObject *module, PyObject *arg)
    169 {
    170     PyObject *return_value = NULL;
    171     PyObject *name;
    172 
    173     if (!PyArg_Parse(arg, "U:get_frozen_object", &name)) {
    174         goto exit;
    175     }
    176     return_value = _imp_get_frozen_object_impl(module, name);
    177 
    178 exit:
    179     return return_value;
    180 }
    181 
    182 PyDoc_STRVAR(_imp_is_frozen_package__doc__,
    183 "is_frozen_package($module, name, /)\n"
    184 "--\n"
    185 "\n"
    186 "Returns True if the module name is of a frozen package.");
    187 
    188 #define _IMP_IS_FROZEN_PACKAGE_METHODDEF    \
    189     {"is_frozen_package", (PyCFunction)_imp_is_frozen_package, METH_O, _imp_is_frozen_package__doc__},
    190 
    191 static PyObject *
    192 _imp_is_frozen_package_impl(PyObject *module, PyObject *name);
    193 
    194 static PyObject *
    195 _imp_is_frozen_package(PyObject *module, PyObject *arg)
    196 {
    197     PyObject *return_value = NULL;
    198     PyObject *name;
    199 
    200     if (!PyArg_Parse(arg, "U:is_frozen_package", &name)) {
    201         goto exit;
    202     }
    203     return_value = _imp_is_frozen_package_impl(module, name);
    204 
    205 exit:
    206     return return_value;
    207 }
    208 
    209 PyDoc_STRVAR(_imp_is_builtin__doc__,
    210 "is_builtin($module, name, /)\n"
    211 "--\n"
    212 "\n"
    213 "Returns True if the module name corresponds to a built-in module.");
    214 
    215 #define _IMP_IS_BUILTIN_METHODDEF    \
    216     {"is_builtin", (PyCFunction)_imp_is_builtin, METH_O, _imp_is_builtin__doc__},
    217 
    218 static PyObject *
    219 _imp_is_builtin_impl(PyObject *module, PyObject *name);
    220 
    221 static PyObject *
    222 _imp_is_builtin(PyObject *module, PyObject *arg)
    223 {
    224     PyObject *return_value = NULL;
    225     PyObject *name;
    226 
    227     if (!PyArg_Parse(arg, "U:is_builtin", &name)) {
    228         goto exit;
    229     }
    230     return_value = _imp_is_builtin_impl(module, name);
    231 
    232 exit:
    233     return return_value;
    234 }
    235 
    236 PyDoc_STRVAR(_imp_is_frozen__doc__,
    237 "is_frozen($module, name, /)\n"
    238 "--\n"
    239 "\n"
    240 "Returns True if the module name corresponds to a frozen module.");
    241 
    242 #define _IMP_IS_FROZEN_METHODDEF    \
    243     {"is_frozen", (PyCFunction)_imp_is_frozen, METH_O, _imp_is_frozen__doc__},
    244 
    245 static PyObject *
    246 _imp_is_frozen_impl(PyObject *module, PyObject *name);
    247 
    248 static PyObject *
    249 _imp_is_frozen(PyObject *module, PyObject *arg)
    250 {
    251     PyObject *return_value = NULL;
    252     PyObject *name;
    253 
    254     if (!PyArg_Parse(arg, "U:is_frozen", &name)) {
    255         goto exit;
    256     }
    257     return_value = _imp_is_frozen_impl(module, name);
    258 
    259 exit:
    260     return return_value;
    261 }
    262 
    263 #if defined(HAVE_DYNAMIC_LOADING)
    264 
    265 PyDoc_STRVAR(_imp_create_dynamic__doc__,
    266 "create_dynamic($module, spec, file=None, /)\n"
    267 "--\n"
    268 "\n"
    269 "Create an extension module.");
    270 
    271 #define _IMP_CREATE_DYNAMIC_METHODDEF    \
    272     {"create_dynamic", (PyCFunction)_imp_create_dynamic, METH_VARARGS, _imp_create_dynamic__doc__},
    273 
    274 static PyObject *
    275 _imp_create_dynamic_impl(PyObject *module, PyObject *spec, PyObject *file);
    276 
    277 static PyObject *
    278 _imp_create_dynamic(PyObject *module, PyObject *args)
    279 {
    280     PyObject *return_value = NULL;
    281     PyObject *spec;
    282     PyObject *file = NULL;
    283 
    284     if (!PyArg_UnpackTuple(args, "create_dynamic",
    285         1, 2,
    286         &spec, &file)) {
    287         goto exit;
    288     }
    289     return_value = _imp_create_dynamic_impl(module, spec, file);
    290 
    291 exit:
    292     return return_value;
    293 }
    294 
    295 #endif /* defined(HAVE_DYNAMIC_LOADING) */
    296 
    297 #if defined(HAVE_DYNAMIC_LOADING)
    298 
    299 PyDoc_STRVAR(_imp_exec_dynamic__doc__,
    300 "exec_dynamic($module, mod, /)\n"
    301 "--\n"
    302 "\n"
    303 "Initialize an extension module.");
    304 
    305 #define _IMP_EXEC_DYNAMIC_METHODDEF    \
    306     {"exec_dynamic", (PyCFunction)_imp_exec_dynamic, METH_O, _imp_exec_dynamic__doc__},
    307 
    308 static int
    309 _imp_exec_dynamic_impl(PyObject *module, PyObject *mod);
    310 
    311 static PyObject *
    312 _imp_exec_dynamic(PyObject *module, PyObject *mod)
    313 {
    314     PyObject *return_value = NULL;
    315     int _return_value;
    316 
    317     _return_value = _imp_exec_dynamic_impl(module, mod);
    318     if ((_return_value == -1) && PyErr_Occurred()) {
    319         goto exit;
    320     }
    321     return_value = PyLong_FromLong((long)_return_value);
    322 
    323 exit:
    324     return return_value;
    325 }
    326 
    327 #endif /* defined(HAVE_DYNAMIC_LOADING) */
    328 
    329 PyDoc_STRVAR(_imp_exec_builtin__doc__,
    330 "exec_builtin($module, mod, /)\n"
    331 "--\n"
    332 "\n"
    333 "Initialize a built-in module.");
    334 
    335 #define _IMP_EXEC_BUILTIN_METHODDEF    \
    336     {"exec_builtin", (PyCFunction)_imp_exec_builtin, METH_O, _imp_exec_builtin__doc__},
    337 
    338 static int
    339 _imp_exec_builtin_impl(PyObject *module, PyObject *mod);
    340 
    341 static PyObject *
    342 _imp_exec_builtin(PyObject *module, PyObject *mod)
    343 {
    344     PyObject *return_value = NULL;
    345     int _return_value;
    346 
    347     _return_value = _imp_exec_builtin_impl(module, mod);
    348     if ((_return_value == -1) && PyErr_Occurred()) {
    349         goto exit;
    350     }
    351     return_value = PyLong_FromLong((long)_return_value);
    352 
    353 exit:
    354     return return_value;
    355 }
    356 
    357 #ifndef _IMP_CREATE_DYNAMIC_METHODDEF
    358     #define _IMP_CREATE_DYNAMIC_METHODDEF
    359 #endif /* !defined(_IMP_CREATE_DYNAMIC_METHODDEF) */
    360 
    361 #ifndef _IMP_EXEC_DYNAMIC_METHODDEF
    362     #define _IMP_EXEC_DYNAMIC_METHODDEF
    363 #endif /* !defined(_IMP_EXEC_DYNAMIC_METHODDEF) */
    364 /*[clinic end generated code: output=d24d7f73702a907f input=a9049054013a1b77]*/
    365