Brett Cannon | fd4d050 | 2014-05-30 11:21:14 -0400 | [diff] [blame] | 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(PyModuleDef *module); |
| 18 | |
| 19 | static PyObject * |
| 20 | _imp_lock_held(PyModuleDef *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(PyModuleDef *module); |
| 39 | |
| 40 | static PyObject * |
| 41 | _imp_acquire_lock(PyModuleDef *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(PyModuleDef *module); |
| 59 | |
| 60 | static PyObject * |
| 61 | _imp_release_lock(PyModuleDef *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 * |
Larry Hastings | 89964c4 | 2015-04-14 18:07:59 -0400 | [diff] [blame] | 81 | _imp__fix_co_filename_impl(PyModuleDef *module, PyCodeObject *code, |
| 82 | PyObject *path); |
Brett Cannon | fd4d050 | 2014-05-30 11:21:14 -0400 | [diff] [blame] | 83 | |
| 84 | static PyObject * |
| 85 | _imp__fix_co_filename(PyModuleDef *module, PyObject *args) |
| 86 | { |
| 87 | PyObject *return_value = NULL; |
| 88 | PyCodeObject *code; |
| 89 | PyObject *path; |
| 90 | |
Serhiy Storchaka | 247789c | 2015-04-24 00:40:51 +0300 | [diff] [blame] | 91 | if (!PyArg_ParseTuple(args, "O!U:_fix_co_filename", |
Brett Cannon | fd4d050 | 2014-05-30 11:21:14 -0400 | [diff] [blame] | 92 | &PyCode_Type, &code, &path)) |
| 93 | goto exit; |
| 94 | return_value = _imp__fix_co_filename_impl(module, code, path); |
| 95 | |
| 96 | exit: |
| 97 | return return_value; |
| 98 | } |
| 99 | |
| 100 | PyDoc_STRVAR(_imp_extension_suffixes__doc__, |
| 101 | "extension_suffixes($module, /)\n" |
| 102 | "--\n" |
| 103 | "\n" |
| 104 | "Returns the list of file suffixes used to identify extension modules."); |
| 105 | |
| 106 | #define _IMP_EXTENSION_SUFFIXES_METHODDEF \ |
| 107 | {"extension_suffixes", (PyCFunction)_imp_extension_suffixes, METH_NOARGS, _imp_extension_suffixes__doc__}, |
| 108 | |
| 109 | static PyObject * |
| 110 | _imp_extension_suffixes_impl(PyModuleDef *module); |
| 111 | |
| 112 | static PyObject * |
| 113 | _imp_extension_suffixes(PyModuleDef *module, PyObject *Py_UNUSED(ignored)) |
| 114 | { |
| 115 | return _imp_extension_suffixes_impl(module); |
| 116 | } |
| 117 | |
| 118 | PyDoc_STRVAR(_imp_init_builtin__doc__, |
| 119 | "init_builtin($module, name, /)\n" |
| 120 | "--\n" |
| 121 | "\n" |
| 122 | "Initializes a built-in module."); |
| 123 | |
| 124 | #define _IMP_INIT_BUILTIN_METHODDEF \ |
Serhiy Storchaka | 92e8af6 | 2015-04-04 00:12:11 +0300 | [diff] [blame] | 125 | {"init_builtin", (PyCFunction)_imp_init_builtin, METH_O, _imp_init_builtin__doc__}, |
Brett Cannon | fd4d050 | 2014-05-30 11:21:14 -0400 | [diff] [blame] | 126 | |
| 127 | static PyObject * |
| 128 | _imp_init_builtin_impl(PyModuleDef *module, PyObject *name); |
| 129 | |
| 130 | static PyObject * |
Serhiy Storchaka | 92e8af6 | 2015-04-04 00:12:11 +0300 | [diff] [blame] | 131 | _imp_init_builtin(PyModuleDef *module, PyObject *arg) |
Brett Cannon | fd4d050 | 2014-05-30 11:21:14 -0400 | [diff] [blame] | 132 | { |
| 133 | PyObject *return_value = NULL; |
| 134 | PyObject *name; |
| 135 | |
Serhiy Storchaka | 247789c | 2015-04-24 00:40:51 +0300 | [diff] [blame] | 136 | if (!PyArg_Parse(arg, "U:init_builtin", &name)) |
Brett Cannon | fd4d050 | 2014-05-30 11:21:14 -0400 | [diff] [blame] | 137 | goto exit; |
| 138 | return_value = _imp_init_builtin_impl(module, name); |
| 139 | |
| 140 | exit: |
| 141 | return return_value; |
| 142 | } |
| 143 | |
| 144 | PyDoc_STRVAR(_imp_init_frozen__doc__, |
| 145 | "init_frozen($module, name, /)\n" |
| 146 | "--\n" |
| 147 | "\n" |
| 148 | "Initializes a frozen module."); |
| 149 | |
| 150 | #define _IMP_INIT_FROZEN_METHODDEF \ |
Serhiy Storchaka | 92e8af6 | 2015-04-04 00:12:11 +0300 | [diff] [blame] | 151 | {"init_frozen", (PyCFunction)_imp_init_frozen, METH_O, _imp_init_frozen__doc__}, |
Brett Cannon | fd4d050 | 2014-05-30 11:21:14 -0400 | [diff] [blame] | 152 | |
| 153 | static PyObject * |
| 154 | _imp_init_frozen_impl(PyModuleDef *module, PyObject *name); |
| 155 | |
| 156 | static PyObject * |
Serhiy Storchaka | 92e8af6 | 2015-04-04 00:12:11 +0300 | [diff] [blame] | 157 | _imp_init_frozen(PyModuleDef *module, PyObject *arg) |
Brett Cannon | fd4d050 | 2014-05-30 11:21:14 -0400 | [diff] [blame] | 158 | { |
| 159 | PyObject *return_value = NULL; |
| 160 | PyObject *name; |
| 161 | |
Serhiy Storchaka | 247789c | 2015-04-24 00:40:51 +0300 | [diff] [blame] | 162 | if (!PyArg_Parse(arg, "U:init_frozen", &name)) |
Brett Cannon | fd4d050 | 2014-05-30 11:21:14 -0400 | [diff] [blame] | 163 | goto exit; |
| 164 | return_value = _imp_init_frozen_impl(module, name); |
| 165 | |
| 166 | exit: |
| 167 | return return_value; |
| 168 | } |
| 169 | |
| 170 | PyDoc_STRVAR(_imp_get_frozen_object__doc__, |
| 171 | "get_frozen_object($module, name, /)\n" |
| 172 | "--\n" |
| 173 | "\n" |
| 174 | "Create a code object for a frozen module."); |
| 175 | |
| 176 | #define _IMP_GET_FROZEN_OBJECT_METHODDEF \ |
Serhiy Storchaka | 92e8af6 | 2015-04-04 00:12:11 +0300 | [diff] [blame] | 177 | {"get_frozen_object", (PyCFunction)_imp_get_frozen_object, METH_O, _imp_get_frozen_object__doc__}, |
Brett Cannon | fd4d050 | 2014-05-30 11:21:14 -0400 | [diff] [blame] | 178 | |
| 179 | static PyObject * |
| 180 | _imp_get_frozen_object_impl(PyModuleDef *module, PyObject *name); |
| 181 | |
| 182 | static PyObject * |
Serhiy Storchaka | 92e8af6 | 2015-04-04 00:12:11 +0300 | [diff] [blame] | 183 | _imp_get_frozen_object(PyModuleDef *module, PyObject *arg) |
Brett Cannon | fd4d050 | 2014-05-30 11:21:14 -0400 | [diff] [blame] | 184 | { |
| 185 | PyObject *return_value = NULL; |
| 186 | PyObject *name; |
| 187 | |
Serhiy Storchaka | 247789c | 2015-04-24 00:40:51 +0300 | [diff] [blame] | 188 | if (!PyArg_Parse(arg, "U:get_frozen_object", &name)) |
Brett Cannon | fd4d050 | 2014-05-30 11:21:14 -0400 | [diff] [blame] | 189 | goto exit; |
| 190 | return_value = _imp_get_frozen_object_impl(module, name); |
| 191 | |
| 192 | exit: |
| 193 | return return_value; |
| 194 | } |
| 195 | |
| 196 | PyDoc_STRVAR(_imp_is_frozen_package__doc__, |
| 197 | "is_frozen_package($module, name, /)\n" |
| 198 | "--\n" |
| 199 | "\n" |
| 200 | "Returns True if the module name is of a frozen package."); |
| 201 | |
| 202 | #define _IMP_IS_FROZEN_PACKAGE_METHODDEF \ |
Serhiy Storchaka | 92e8af6 | 2015-04-04 00:12:11 +0300 | [diff] [blame] | 203 | {"is_frozen_package", (PyCFunction)_imp_is_frozen_package, METH_O, _imp_is_frozen_package__doc__}, |
Brett Cannon | fd4d050 | 2014-05-30 11:21:14 -0400 | [diff] [blame] | 204 | |
| 205 | static PyObject * |
| 206 | _imp_is_frozen_package_impl(PyModuleDef *module, PyObject *name); |
| 207 | |
| 208 | static PyObject * |
Serhiy Storchaka | 92e8af6 | 2015-04-04 00:12:11 +0300 | [diff] [blame] | 209 | _imp_is_frozen_package(PyModuleDef *module, PyObject *arg) |
Brett Cannon | fd4d050 | 2014-05-30 11:21:14 -0400 | [diff] [blame] | 210 | { |
| 211 | PyObject *return_value = NULL; |
| 212 | PyObject *name; |
| 213 | |
Serhiy Storchaka | 247789c | 2015-04-24 00:40:51 +0300 | [diff] [blame] | 214 | if (!PyArg_Parse(arg, "U:is_frozen_package", &name)) |
Brett Cannon | fd4d050 | 2014-05-30 11:21:14 -0400 | [diff] [blame] | 215 | goto exit; |
| 216 | return_value = _imp_is_frozen_package_impl(module, name); |
| 217 | |
| 218 | exit: |
| 219 | return return_value; |
| 220 | } |
| 221 | |
| 222 | PyDoc_STRVAR(_imp_is_builtin__doc__, |
| 223 | "is_builtin($module, name, /)\n" |
| 224 | "--\n" |
| 225 | "\n" |
| 226 | "Returns True if the module name corresponds to a built-in module."); |
| 227 | |
| 228 | #define _IMP_IS_BUILTIN_METHODDEF \ |
Serhiy Storchaka | 92e8af6 | 2015-04-04 00:12:11 +0300 | [diff] [blame] | 229 | {"is_builtin", (PyCFunction)_imp_is_builtin, METH_O, _imp_is_builtin__doc__}, |
Brett Cannon | fd4d050 | 2014-05-30 11:21:14 -0400 | [diff] [blame] | 230 | |
| 231 | static PyObject * |
| 232 | _imp_is_builtin_impl(PyModuleDef *module, PyObject *name); |
| 233 | |
| 234 | static PyObject * |
Serhiy Storchaka | 92e8af6 | 2015-04-04 00:12:11 +0300 | [diff] [blame] | 235 | _imp_is_builtin(PyModuleDef *module, PyObject *arg) |
Brett Cannon | fd4d050 | 2014-05-30 11:21:14 -0400 | [diff] [blame] | 236 | { |
| 237 | PyObject *return_value = NULL; |
| 238 | PyObject *name; |
| 239 | |
Serhiy Storchaka | 247789c | 2015-04-24 00:40:51 +0300 | [diff] [blame] | 240 | if (!PyArg_Parse(arg, "U:is_builtin", &name)) |
Brett Cannon | fd4d050 | 2014-05-30 11:21:14 -0400 | [diff] [blame] | 241 | goto exit; |
| 242 | return_value = _imp_is_builtin_impl(module, name); |
| 243 | |
| 244 | exit: |
| 245 | return return_value; |
| 246 | } |
| 247 | |
| 248 | PyDoc_STRVAR(_imp_is_frozen__doc__, |
| 249 | "is_frozen($module, name, /)\n" |
| 250 | "--\n" |
| 251 | "\n" |
| 252 | "Returns True if the module name corresponds to a frozen module."); |
| 253 | |
| 254 | #define _IMP_IS_FROZEN_METHODDEF \ |
Serhiy Storchaka | 92e8af6 | 2015-04-04 00:12:11 +0300 | [diff] [blame] | 255 | {"is_frozen", (PyCFunction)_imp_is_frozen, METH_O, _imp_is_frozen__doc__}, |
Brett Cannon | fd4d050 | 2014-05-30 11:21:14 -0400 | [diff] [blame] | 256 | |
| 257 | static PyObject * |
| 258 | _imp_is_frozen_impl(PyModuleDef *module, PyObject *name); |
| 259 | |
| 260 | static PyObject * |
Serhiy Storchaka | 92e8af6 | 2015-04-04 00:12:11 +0300 | [diff] [blame] | 261 | _imp_is_frozen(PyModuleDef *module, PyObject *arg) |
Brett Cannon | fd4d050 | 2014-05-30 11:21:14 -0400 | [diff] [blame] | 262 | { |
| 263 | PyObject *return_value = NULL; |
| 264 | PyObject *name; |
| 265 | |
Serhiy Storchaka | 247789c | 2015-04-24 00:40:51 +0300 | [diff] [blame] | 266 | if (!PyArg_Parse(arg, "U:is_frozen", &name)) |
Brett Cannon | fd4d050 | 2014-05-30 11:21:14 -0400 | [diff] [blame] | 267 | goto exit; |
| 268 | return_value = _imp_is_frozen_impl(module, name); |
| 269 | |
| 270 | exit: |
| 271 | return return_value; |
| 272 | } |
| 273 | |
| 274 | #if defined(HAVE_DYNAMIC_LOADING) |
| 275 | |
| 276 | PyDoc_STRVAR(_imp_load_dynamic__doc__, |
| 277 | "load_dynamic($module, name, path, file=None, /)\n" |
| 278 | "--\n" |
| 279 | "\n" |
| 280 | "Loads an extension module."); |
| 281 | |
| 282 | #define _IMP_LOAD_DYNAMIC_METHODDEF \ |
| 283 | {"load_dynamic", (PyCFunction)_imp_load_dynamic, METH_VARARGS, _imp_load_dynamic__doc__}, |
| 284 | |
| 285 | static PyObject * |
Larry Hastings | 89964c4 | 2015-04-14 18:07:59 -0400 | [diff] [blame] | 286 | _imp_load_dynamic_impl(PyModuleDef *module, PyObject *name, PyObject *path, |
| 287 | PyObject *file); |
Brett Cannon | fd4d050 | 2014-05-30 11:21:14 -0400 | [diff] [blame] | 288 | |
| 289 | static PyObject * |
| 290 | _imp_load_dynamic(PyModuleDef *module, PyObject *args) |
| 291 | { |
| 292 | PyObject *return_value = NULL; |
| 293 | PyObject *name; |
| 294 | PyObject *path; |
| 295 | PyObject *file = NULL; |
| 296 | |
Serhiy Storchaka | 247789c | 2015-04-24 00:40:51 +0300 | [diff] [blame] | 297 | if (!PyArg_ParseTuple(args, "UO&|O:load_dynamic", |
Brett Cannon | fd4d050 | 2014-05-30 11:21:14 -0400 | [diff] [blame] | 298 | &name, PyUnicode_FSDecoder, &path, &file)) |
| 299 | goto exit; |
| 300 | return_value = _imp_load_dynamic_impl(module, name, path, file); |
| 301 | |
| 302 | exit: |
| 303 | return return_value; |
| 304 | } |
| 305 | |
| 306 | #endif /* defined(HAVE_DYNAMIC_LOADING) */ |
| 307 | |
| 308 | #ifndef _IMP_LOAD_DYNAMIC_METHODDEF |
| 309 | #define _IMP_LOAD_DYNAMIC_METHODDEF |
| 310 | #endif /* !defined(_IMP_LOAD_DYNAMIC_METHODDEF) */ |
Serhiy Storchaka | 247789c | 2015-04-24 00:40:51 +0300 | [diff] [blame] | 311 | /*[clinic end generated code: output=6d75cece35863874 input=a9049054013a1b77]*/ |