#include "Python.h" #include "code.h" #include "Python-ast.h" #include "symtable.h" #include "clinic/symtablemodule.c.h" /*[clinic input] module _symtable [clinic start generated code]*/ /*[clinic end generated code: output=da39a3ee5e6b4b0d input=f4685845a7100605]*/ /*[clinic input] _symtable.symtable str: str filename: object(converter='PyUnicode_FSDecoder') startstr: str / Return symbol and scope dictionaries used internally by compiler. [clinic start generated code]*/ static PyObject * _symtable_symtable_impl(PyObject *module, const char *str, PyObject *filename, const char *startstr) /*[clinic end generated code: output=914b369c9b785956 input=6c615e84d5f408e3]*/ { struct symtable *st; PyObject *t; int start; if (strcmp(startstr, "exec") == 0) start = Py_file_input; else if (strcmp(startstr, "eval") == 0) start = Py_eval_input; else if (strcmp(startstr, "single") == 0) start = Py_single_input; else { PyErr_SetString(PyExc_ValueError, "symtable() arg 3 must be 'exec' or 'eval' or 'single'"); Py_DECREF(filename); return NULL; } st = Py_SymtableStringObject(str, filename, start); Py_DECREF(filename); if (st == NULL) return NULL; t = (PyObject *)st->st_top; Py_INCREF(t); PyMem_Free((void *)st->st_future); PySymtable_Free(st); return t; } static PyMethodDef symtable_methods[] = { _SYMTABLE_SYMTABLE_METHODDEF {NULL, NULL} /* sentinel */ }; static struct PyModuleDef symtablemodule = { PyModuleDef_HEAD_INIT, "_symtable", NULL, -1, symtable_methods, NULL, NULL, NULL, NULL }; PyMODINIT_FUNC PyInit__symtable(void) { PyObject *m; if (PyType_Ready(&PySTEntry_Type) < 0) return NULL; m = PyModule_Create(&symtablemodule); if (m == NULL) return NULL; PyModule_AddIntMacro(m, USE); PyModule_AddIntMacro(m, DEF_GLOBAL); PyModule_AddIntMacro(m, DEF_LOCAL); PyModule_AddIntMacro(m, DEF_PARAM); PyModule_AddIntMacro(m, DEF_FREE); PyModule_AddIntMacro(m, DEF_FREE_CLASS); PyModule_AddIntMacro(m, DEF_IMPORT); PyModule_AddIntMacro(m, DEF_BOUND); PyModule_AddIntMacro(m, DEF_ANNOT); PyModule_AddIntConstant(m, "TYPE_FUNCTION", FunctionBlock); PyModule_AddIntConstant(m, "TYPE_CLASS", ClassBlock); PyModule_AddIntConstant(m, "TYPE_MODULE", ModuleBlock); PyModule_AddIntMacro(m, LOCAL); PyModule_AddIntMacro(m, GLOBAL_EXPLICIT); PyModule_AddIntMacro(m, GLOBAL_IMPLICIT); PyModule_AddIntMacro(m, FREE); PyModule_AddIntMacro(m, CELL); PyModule_AddIntConstant(m, "SCOPE_OFF", SCOPE_OFFSET); PyModule_AddIntMacro(m, SCOPE_MASK); if (PyErr_Occurred()) { Py_DECREF(m); m = 0; } return m; }
Mode | Type | Size | Ref | File |
---|---|---|---|---|
100644 | blob | 582 | 58471109208922c9ee8c4b06135725f03ed16814 | .bzrignore |
100644 | blob | 545 | fcf9df6a7a698e4bd87ed0c1cc4ed70bad8b9887 | .codecov.yml |
100644 | blob | 255 | 82694d81f276b2c59a0a93a4f678e1852e625052 | .gitattributes |
040000 | tree | - | 7e849e161267e730810fbbe6a848b14d5d002788 | .github |
100644 | blob | 1397 | 8b54c2c4861389f6e8bbfbab5ae0c8b6bbbad041 | .gitignore |
100644 | blob | 1060 | eb19a6c88d28d05588db25d21525ee2e19c22666 | .hgeol |
100644 | blob | 1358 | 68c607f2e8d420c8dfd0748efcd3b3b5447def16 | .hgignore |
100644 | blob | 8917 | 8f51c2ced49aed46d8b480280b630ea4264c57c3 | .hgtags |
100644 | blob | 1328 | b9be0f11fdb829f16e9de1921257eb7ee45fac57 | .hgtouch |
100644 | blob | 248 | 0614a299b6221dc7faedaa9139ae8b034e618a85 | .mention-bot |
100644 | blob | 3512 | e7e8694530ca21a6d7a19da3fab687a3e9d79e9c | .travis.yml |
040000 | tree | - | ef39fb38058ea1cb07d5a66c7d0c338d5c9c634d | Doc |
040000 | tree | - | 5dd6fc9dc09374506491247872c868eca111e256 | Grammar |
040000 | tree | - | df0de9d4359f11311c74fd0dbad471bb2613a2d4 | Include |
100644 | blob | 12773 | f5d0b39a0cdddb91a31a537052b7d8d31a4aa79f | LICENSE |
040000 | tree | - | 41936e36e534f9069cb438b31908d8e097c673ee | Lib |
040000 | tree | - | 1db7415d4375525eaf8d05ddd5b088de3321041c | Mac |
100644 | blob | 58983 | 4145634c032d543d02295bd2c28a0c6ce839fa86 | Makefile.pre.in |
040000 | tree | - | 5ce39d28202a5713d0cff1c4cd7eb73267ea1a08 | Misc |
040000 | tree | - | b74dfdc5f8f5700baaab0dbd2aa197899f8b79d9 | Modules |
040000 | tree | - | 774ee56f73f58d31a7e7d59314020c9176eeb9d8 | Objects |
040000 | tree | - | ed4f35810e9633502c16ae038c2ce697d3987201 | PC |
040000 | tree | - | 37a613ac0022a9cfefaf3f13913fec7debe59259 | PCbuild |
040000 | tree | - | 75771c7c20fe7a121d596299c5440aef10c6f884 | Parser |
040000 | tree | - | 3efbcc80237ab7c3d4eb5bf31c893ca6de88e747 | Programs |
040000 | tree | - | ec8f975802930f631229dd3f1c1dd6e327557ae8 | Python |
100644 | blob | 9325 | 9c95815d9e9d91b8dae8e05d8bbc696fe19f796b | README.rst |
040000 | tree | - | 6f90a7ecc8b4a12e0377f892c8639ef99da08920 | Tools |
100644 | blob | 10910 | 9a9cc557281571f0d46c506c0e9d1b9fb25e063c | aclocal.m4 |
100755 | blob | 42856 | 1f5c50c0d1529d50b94dc3533ca72a47f0fa5849 | config.guess |
100755 | blob | 35740 | d654d03cdcd2226a5d7584890717e674a8122f4f | config.sub |
100755 | blob | 485283 | 87504d206837baf5a5781b6e1cc44dcce7138af9 | configure |
100644 | blob | 160661 | f9bd92ce3da29ea7674a32bd5fe511b1fc4c4d0a | configure.ac |
100755 | blob | 7122 | 0ec27bcd488da5cad6ead13d70accbdbc40d31ef | install-sh |
100644 | blob | 41449 | 21354a5cb84fe5530dd0d460561ba95569abe1d4 | pyconfig.h.in |
100644 | blob | 98743 | 3b3d097454211c790c1602d759918bb65a622c97 | setup.py |