/src/cpython/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 | | #include "pycore_modsupport.h" // _PyArg_CheckPositional() |
6 | | |
7 | | PyDoc_STRVAR(_symtable_symtable__doc__, |
8 | | "symtable($module, source, filename, startstr, /)\n" |
9 | | "--\n" |
10 | | "\n" |
11 | | "Return symbol and scope dictionaries used internally by compiler."); |
12 | | |
13 | | #define _SYMTABLE_SYMTABLE_METHODDEF \ |
14 | | {"symtable", _PyCFunction_CAST(_symtable_symtable), METH_FASTCALL, _symtable_symtable__doc__}, |
15 | | |
16 | | static PyObject * |
17 | | _symtable_symtable_impl(PyObject *module, PyObject *source, |
18 | | PyObject *filename, const char *startstr); |
19 | | |
20 | | static PyObject * |
21 | | _symtable_symtable(PyObject *module, PyObject *const *args, Py_ssize_t nargs) |
22 | 0 | { |
23 | 0 | PyObject *return_value = NULL; |
24 | 0 | PyObject *source; |
25 | 0 | PyObject *filename; |
26 | 0 | const char *startstr; |
27 | |
|
28 | 0 | if (!_PyArg_CheckPositional("symtable", nargs, 3, 3)) { |
29 | 0 | goto exit; |
30 | 0 | } |
31 | 0 | source = args[0]; |
32 | 0 | if (!PyUnicode_FSDecoder(args[1], &filename)) { |
33 | 0 | goto exit; |
34 | 0 | } |
35 | 0 | if (!PyUnicode_Check(args[2])) { |
36 | 0 | _PyArg_BadArgument("symtable", "argument 3", "str", args[2]); |
37 | 0 | goto exit; |
38 | 0 | } |
39 | 0 | Py_ssize_t startstr_length; |
40 | 0 | startstr = PyUnicode_AsUTF8AndSize(args[2], &startstr_length); |
41 | 0 | if (startstr == NULL) { |
42 | 0 | goto exit; |
43 | 0 | } |
44 | 0 | if (strlen(startstr) != (size_t)startstr_length) { |
45 | 0 | PyErr_SetString(PyExc_ValueError, "embedded null character"); |
46 | 0 | goto exit; |
47 | 0 | } |
48 | 0 | return_value = _symtable_symtable_impl(module, source, filename, startstr); |
49 | |
|
50 | 0 | exit: |
51 | 0 | return return_value; |
52 | 0 | } |
53 | | /*[clinic end generated code: output=931964a76a72f850 input=a9049054013a1b77]*/ |