Branch data Line data Source code
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 : 0 : _symtable_symtable(PyObject *module, PyObject *const *args, Py_ssize_t nargs) 26 : : { 27 : 0 : PyObject *return_value = NULL; 28 : : PyObject *source; 29 : : PyObject *filename; 30 : : const char *startstr; 31 : : 32 [ # # # # : 0 : if (!_PyArg_CheckPositional("symtable", nargs, 3, 3)) { # # ] 33 : 0 : goto exit; 34 : : } 35 : 0 : source = args[0]; 36 [ # # ]: 0 : if (!PyUnicode_FSDecoder(args[1], &filename)) { 37 : 0 : goto exit; 38 : : } 39 [ # # ]: 0 : if (!PyUnicode_Check(args[2])) { 40 : 0 : _PyArg_BadArgument("symtable", "argument 3", "str", args[2]); 41 : 0 : goto exit; 42 : : } 43 : : Py_ssize_t startstr_length; 44 : 0 : startstr = PyUnicode_AsUTF8AndSize(args[2], &startstr_length); 45 [ # # ]: 0 : if (startstr == NULL) { 46 : 0 : goto exit; 47 : : } 48 [ # # ]: 0 : if (strlen(startstr) != (size_t)startstr_length) { 49 : 0 : PyErr_SetString(PyExc_ValueError, "embedded null character"); 50 : 0 : goto exit; 51 : : } 52 : 0 : return_value = _symtable_symtable_impl(module, source, filename, startstr); 53 : : 54 : 0 : exit: 55 : 0 : return return_value; 56 : : } 57 : : /*[clinic end generated code: output=07716ddbd6c7efe1 input=a9049054013a1b77]*/