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