summaryrefslogtreecommitdiffstats
path: root/Python/clinic/import.c.h
blob: 7618577e6546f6fe9b285a278476673ce4ff5478 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
/*[clinic input]
preserve
[clinic start generated code]*/

PyDoc_STRVAR(_imp_lock_held__doc__,
"lock_held($module, /)\n"
"--\n"
"\n"
"Return True if the import lock is currently held, else False.\n"
"\n"
"On platforms without threads, return False.");

#define _IMP_LOCK_HELD_METHODDEF    \
    {"lock_held", (PyCFunction)_imp_lock_held, METH_NOARGS, _imp_lock_held__doc__},

static PyObject *
_imp_lock_held_impl(PyModuleDef *module);

static PyObject *
_imp_lock_held(PyModuleDef *module, PyObject *Py_UNUSED(ignored))
{
    return _imp_lock_held_impl(module);
}

PyDoc_STRVAR(_imp_acquire_lock__doc__,
"acquire_lock($module, /)\n"
"--\n"
"\n"
"Acquires the interpreter\'s import lock for the current thread.\n"
"\n"
"This lock should be used by import hooks to ensure thread-safety when importing\n"
"modules. On platforms without threads, this function does nothing.");

#define _IMP_ACQUIRE_LOCK_METHODDEF    \
    {"acquire_lock", (PyCFunction)_imp_acquire_lock, METH_NOARGS, _imp_acquire_lock__doc__},

static PyObject *
_imp_acquire_lock_impl(PyModuleDef *module);

static PyObject *
_imp_acquire_lock(PyModuleDef *module, PyObject *Py_UNUSED(ignored))
{
    return _imp_acquire_lock_impl(module);
}

PyDoc_STRVAR(_imp_release_lock__doc__,
"release_lock($module, /)\n"
"--\n"
"\n"
"Release the interpreter\'s import lock.\n"
"\n"
"On platforms without threads, this function does nothing.");

#define _IMP_RELEASE_LOCK_METHODDEF    \
    {"release_lock", (PyCFunction)_imp_release_lock, METH_NOARGS, _imp_release_lock__doc__},

static PyObject *
_imp_release_lock_impl(PyModuleDef *module);

static PyObject *
_imp_release_lock(PyModuleDef *module, PyObject *Py_UNUSED(ignored))
{
    return _imp_release_lock_impl(module);
}

PyDoc_STRVAR(_imp__fix_co_filename__doc__,
"_fix_co_filename($module, code, path, /)\n"
"--\n"
"\n"
"Changes code.co_filename to specify the passed-in file path.\n"
"\n"
"  code\n"
"    Code object to change.\n"
"  path\n"
"    File path to use.");

#define _IMP__FIX_CO_FILENAME_METHODDEF    \
    {"_fix_co_filename", (PyCFunction)_imp__fix_co_filename, METH_VARARGS, _imp__fix_co_filename__doc__},

static PyObject *
_imp__fix_co_filename_impl(PyModuleDef *module, PyCodeObject *code, PyObject *path);

static PyObject *
_imp__fix_co_filename(PyModuleDef *module, PyObject *args)
{
    PyObject *return_value = NULL;
    PyCodeObject *code;
    PyObject *path;

    if (!PyArg_ParseTuple(args,
        "O!U:_fix_co_filename",
        &PyCode_Type, &code, &path))
        goto exit;
    return_value = _imp__fix_co_filename_impl(module, code, path);

exit:
    return return_value;
}

PyDoc_STRVAR(_imp_extension_suffixes__doc__,
"extension_suffixes($module, /)\n"
"--\n"
"\n"
"Returns the list of file suffixes used to identify extension modules.");

#define _IMP_EXTENSION_SUFFIXES_METHODDEF    \
    {"extension_suffixes", (PyCFunction)_imp_extension_suffixes, METH_NOARGS, _imp_extension_suffixes__doc__},

static PyObject *
_imp_extension_suffixes_impl(PyModuleDef *module);

static PyObject *
_imp_extension_suffixes(PyModuleDef *module, PyObject *Py_UNUSED(ignored))
{
    return _imp_extension_suffixes_impl(module);
}

PyDoc_STRVAR(_imp_init_builtin__doc__,
"init_builtin($module, name, /)\n"
"--\n"
"\n"
"Initializes a built-in module.");

#define _IMP_INIT_BUILTIN_METHODDEF    \
    {"init_builtin", (PyCFunction)_imp_init_builtin, METH_VARARGS, _imp_init_builtin__doc__},

static PyObject *
_imp_init_builtin_impl(PyModuleDef *module, PyObject *name);

static PyObject *
_imp_init_builtin(PyModuleDef *module, PyObject *args)
{
    PyObject *return_value = NULL;
    PyObject *name;

    if (!PyArg_ParseTuple(args,
        "U:init_builtin",
        &name))
        goto exit;
    return_value = _imp_init_builtin_impl(module, name);

exit:
    return return_value;
}

PyDoc_STRVAR(_imp_init_frozen__doc__,
"init_frozen($module, name, /)\n"
"--\n"
"\n"
"Initializes a frozen module.");

#define _IMP_INIT_FROZEN_METHODDEF    \
    {"init_frozen", (PyCFunction)_imp_init_frozen, METH_VARARGS, _imp_init_frozen__doc__},

static PyObject *
_imp_init_frozen_impl(PyModuleDef *module, PyObject *name);

static PyObject *
_imp_init_frozen(PyModuleDef *module, PyObject *args)
{
    PyObject *return_value = NULL;
    PyObject *name;

    if (!PyArg_ParseTuple(args,
        "U:init_frozen",
        &name))
        goto exit;
    return_value = _imp_init_frozen_impl(module, name);

exit:
    return return_value;
}

PyDoc_STRVAR(_imp_get_frozen_object__doc__,
"get_frozen_object($module, name, /)\n"
"--\n"
"\n"
"Create a code object for a frozen module.");

#define _IMP_GET_FROZEN_OBJECT_METHODDEF    \
    {"get_frozen_object", (PyCFunction)_imp_get_frozen_object, METH_VARARGS, _imp_get_frozen_object__doc__},

static PyObject *
_imp_get_frozen_object_impl(PyModuleDef *module, PyObject *name);

static PyObject *
_imp_get_frozen_object(PyModuleDef *module, PyObject *args)
{
    PyObject *return_value = NULL;
    PyObject *name;

    if (!PyArg_ParseTuple(args,
        "U:get_frozen_object",
        &name))
        goto exit;
    return_value = _imp_get_frozen_object_impl(module, name);

exit:
    return return_value;
}

PyDoc_STRVAR(_imp_is_frozen_package__doc__,
"is_frozen_package($module, name, /)\n"
"--\n"
"\n"
"Returns True if the module name is of a frozen package.");

#define _IMP_IS_FROZEN_PACKAGE_METHODDEF    \
    {"is_frozen_package", (PyCFunction)_imp_is_frozen_package, METH_VARARGS, _imp_is_frozen_package__doc__},

static PyObject *
_imp_is_frozen_package_impl(PyModuleDef *module, PyObject *name);

static PyObject *
_imp_is_frozen_package(PyModuleDef *module, PyObject *args)
{
    PyObject *return_value = NULL;
    PyObject *name;

    if (!PyArg_ParseTuple(args,
        "U:is_frozen_package",
        &name))
        goto exit;
    return_value = _imp_is_frozen_package_impl(module, name);

exit:
    return return_value;
}

PyDoc_STRVAR(_imp_is_builtin__doc__,
"is_builtin($module, name, /)\n"
"--\n"
"\n"
"Returns True if the module name corresponds to a built-in module.");

#define _IMP_IS_BUILTIN_METHODDEF    \
    {"is_builtin", (PyCFunction)_imp_is_builtin, METH_VARARGS, _imp_is_builtin__doc__},

static PyObject *
_imp_is_builtin_impl(PyModuleDef *module, PyObject *name);

static PyObject *
_imp_is_builtin(PyModuleDef *module, PyObject *args)
{
    PyObject *return_value = NULL;
    PyObject *name;

    if (!PyArg_ParseTuple(args,
        "U:is_builtin",
        &name))
        goto exit;
    return_value = _imp_is_builtin_impl(module, name);

exit:
    return return_value;
}

PyDoc_STRVAR(_imp_is_frozen__doc__,
"is_frozen($module, name, /)\n"
"--\n"
"\n"
"Returns True if the module name corresponds to a frozen module.");

#define _IMP_IS_FROZEN_METHODDEF    \
    {"is_frozen", (PyCFunction)_imp_is_frozen, METH_VARARGS, _imp_is_frozen__doc__},

static PyObject *
_imp_is_frozen_impl(PyModuleDef *module, PyObject *name);

static PyObject *
_imp_is_frozen(PyModuleDef *module, PyObject *args)
{
    PyObject *return_value = NULL;
    PyObject *name;

    if (!PyArg_ParseTuple(args,
        "U:is_frozen",
        &name))
        goto exit;
    return_value = _imp_is_frozen_impl(module, name);

exit:
    return return_value;
}

#if defined(HAVE_DYNAMIC_LOADING)

PyDoc_STRVAR(_imp_load_dynamic__doc__,
"load_dynamic($module, name, path, file=None, /)\n"
"--\n"
"\n"
"Loads an extension module.");

#define _IMP_LOAD_DYNAMIC_METHODDEF    \
    {"load_dynamic", (PyCFunction)_imp_load_dynamic, METH_VARARGS, _imp_load_dynamic__doc__},

static PyObject *
_imp_load_dynamic_impl(PyModuleDef *module, PyObject *name, PyObject *path, PyObject *file);

static PyObject *
_imp_load_dynamic(PyModuleDef *module, PyObject *args)
{
    PyObject *return_value = NULL;
    PyObject *name;
    PyObject *path;
    PyObject *file = NULL;

    if (!PyArg_ParseTuple(args,
        "UO&|O:load_dynamic",
        &name, PyUnicode_FSDecoder, &path, &file))
        goto exit;
    return_value = _imp_load_dynamic_impl(module, name, path, file);

exit:
    return return_value;
}

#endif /* defined(HAVE_DYNAMIC_LOADING) */

#ifndef _IMP_LOAD_DYNAMIC_METHODDEF
    #define _IMP_LOAD_DYNAMIC_METHODDEF
#endif /* !defined(_IMP_LOAD_DYNAMIC_METHODDEF) */
/*[clinic end generated code: output=087a1f22e9febcc7 input=a9049054013a1b77]*/