/src/Python-3.8.3/Modules/clinic/symtablemodule.c.h
Line | Count | Source (jump to first uncovered line) |
1 | | /*[clinic input] |
2 | | preserve |
3 | | [clinic start generated code]*/ |
4 | | |
5 | | PyDoc_STRVAR(_symtable_symtable__doc__, |
6 | | "symtable($module, source, filename, startstr, /)\n" |
7 | | "--\n" |
8 | | "\n" |
9 | | "Return symbol and scope dictionaries used internally by compiler."); |
10 | | |
11 | | #define _SYMTABLE_SYMTABLE_METHODDEF \ |
12 | | {"symtable", (PyCFunction)(void(*)(void))_symtable_symtable, METH_FASTCALL, _symtable_symtable__doc__}, |
13 | | |
14 | | static PyObject * |
15 | | _symtable_symtable_impl(PyObject *module, PyObject *source, |
16 | | PyObject *filename, const char *startstr); |
17 | | |
18 | | static PyObject * |
19 | | _symtable_symtable(PyObject *module, PyObject *const *args, Py_ssize_t nargs) |
20 | 0 | { |
21 | 0 | PyObject *return_value = NULL; |
22 | 0 | PyObject *source; |
23 | 0 | PyObject *filename; |
24 | 0 | const char *startstr; |
25 | |
|
26 | 0 | if (!_PyArg_CheckPositional("symtable", nargs, 3, 3)) { |
27 | 0 | goto exit; |
28 | 0 | } |
29 | 0 | source = args[0]; |
30 | 0 | if (!PyUnicode_FSDecoder(args[1], &filename)) { |
31 | 0 | goto exit; |
32 | 0 | } |
33 | 0 | if (!PyUnicode_Check(args[2])) { |
34 | 0 | _PyArg_BadArgument("symtable", "argument 3", "str", args[2]); |
35 | 0 | goto exit; |
36 | 0 | } |
37 | 0 | Py_ssize_t startstr_length; |
38 | 0 | startstr = PyUnicode_AsUTF8AndSize(args[2], &startstr_length); |
39 | 0 | if (startstr == NULL) { |
40 | 0 | goto exit; |
41 | 0 | } |
42 | 0 | if (strlen(startstr) != (size_t)startstr_length) { |
43 | 0 | PyErr_SetString(PyExc_ValueError, "embedded null character"); |
44 | 0 | goto exit; |
45 | 0 | } |
46 | 0 | return_value = _symtable_symtable_impl(module, source, filename, startstr); |
47 | |
|
48 | 0 | exit: |
49 | 0 | return return_value; |
50 | 0 | } |
51 | | /*[clinic end generated code: output=a12f75cdbdf4e52a input=a9049054013a1b77]*/ |