Coverage Report

Created: 2025-07-04 06:49

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