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