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