/src/cpython/Modules/clinic/_suggestions.c.h
Line | Count | Source |
1 | | /*[clinic input] |
2 | | preserve |
3 | | [clinic start generated code]*/ |
4 | | |
5 | | #include "pycore_critical_section.h"// Py_BEGIN_CRITICAL_SECTION() |
6 | | #include "pycore_modsupport.h" // _PyArg_CheckPositional() |
7 | | |
8 | | PyDoc_STRVAR(_suggestions__generate_suggestions__doc__, |
9 | | "_generate_suggestions($module, candidates, item, /)\n" |
10 | | "--\n" |
11 | | "\n" |
12 | | "Returns the candidate in candidates that\'s closest to item"); |
13 | | |
14 | | #define _SUGGESTIONS__GENERATE_SUGGESTIONS_METHODDEF \ |
15 | | {"_generate_suggestions", _PyCFunction_CAST(_suggestions__generate_suggestions), METH_FASTCALL, _suggestions__generate_suggestions__doc__}, |
16 | | |
17 | | static PyObject * |
18 | | _suggestions__generate_suggestions_impl(PyObject *module, |
19 | | PyObject *candidates, PyObject *item); |
20 | | |
21 | | static PyObject * |
22 | | _suggestions__generate_suggestions(PyObject *module, PyObject *const *args, Py_ssize_t nargs) |
23 | 0 | { |
24 | 0 | PyObject *return_value = NULL; |
25 | 0 | PyObject *candidates; |
26 | 0 | PyObject *item; |
27 | |
|
28 | 0 | if (!_PyArg_CheckPositional("_generate_suggestions", nargs, 2, 2)) { |
29 | 0 | goto exit; |
30 | 0 | } |
31 | 0 | candidates = args[0]; |
32 | 0 | if (!PyUnicode_Check(args[1])) { |
33 | 0 | _PyArg_BadArgument("_generate_suggestions", "argument 2", "str", args[1]); |
34 | 0 | goto exit; |
35 | 0 | } |
36 | 0 | item = args[1]; |
37 | 0 | Py_BEGIN_CRITICAL_SECTION(candidates); |
38 | 0 | return_value = _suggestions__generate_suggestions_impl(module, candidates, item); |
39 | 0 | Py_END_CRITICAL_SECTION(); |
40 | |
|
41 | 0 | exit: |
42 | 0 | return return_value; |
43 | 0 | } |
44 | | /*[clinic end generated code: output=1690dd15a464d19c input=a9049054013a1b77]*/ |