diff options
Diffstat (limited to 'Modules/symtablemodule.c')
| -rw-r--r-- | Modules/symtablemodule.c | 42 | 
1 files changed, 22 insertions, 20 deletions
| diff --git a/Modules/symtablemodule.c b/Modules/symtablemodule.c index 37df82d8b0..cdb4ffcbd8 100644 --- a/Modules/symtablemodule.c +++ b/Modules/symtablemodule.c @@ -11,12 +11,12 @@ symtable_symtable(PyObject *self, PyObject *args)      PyObject *t;      char *str; -    char *filename; +    PyObject *filename;      char *startstr;      int start; -    if (!PyArg_ParseTuple(args, "sss:symtable", &str, &filename, -                          &startstr)) +    if (!PyArg_ParseTuple(args, "sO&s:symtable", +                          &str, PyUnicode_FSDecoder, &filename, &startstr))          return NULL;      if (strcmp(startstr, "exec") == 0)          start = Py_file_input; @@ -27,9 +27,11 @@ symtable_symtable(PyObject *self, PyObject *args)      else {          PyErr_SetString(PyExc_ValueError,             "symtable() arg 3 must be 'exec' or 'eval' or 'single'"); +        Py_DECREF(filename);          return NULL;      } -    st = Py_SymtableString(str, filename, start); +    st = Py_SymtableStringObject(str, filename, start); +    Py_DECREF(filename);      if (st == NULL)          return NULL;      t = (PyObject *)st->st_top; @@ -69,30 +71,30 @@ PyInit__symtable(void)      m = PyModule_Create(&symtablemodule);      if (m == NULL)          return NULL; -    PyModule_AddIntConstant(m, "USE", USE); -    PyModule_AddIntConstant(m, "DEF_GLOBAL", DEF_GLOBAL); -    PyModule_AddIntConstant(m, "DEF_LOCAL", DEF_LOCAL); -    PyModule_AddIntConstant(m, "DEF_PARAM", DEF_PARAM); -    PyModule_AddIntConstant(m, "DEF_FREE", DEF_FREE); -    PyModule_AddIntConstant(m, "DEF_FREE_CLASS", DEF_FREE_CLASS); -    PyModule_AddIntConstant(m, "DEF_IMPORT", DEF_IMPORT); -    PyModule_AddIntConstant(m, "DEF_BOUND", DEF_BOUND); +    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_AddIntConstant(m, "TYPE_FUNCTION", FunctionBlock);      PyModule_AddIntConstant(m, "TYPE_CLASS", ClassBlock);      PyModule_AddIntConstant(m, "TYPE_MODULE", ModuleBlock); -    PyModule_AddIntConstant(m, "OPT_IMPORT_STAR", OPT_IMPORT_STAR); -    PyModule_AddIntConstant(m, "OPT_TOPLEVEL", OPT_TOPLEVEL); +    PyModule_AddIntMacro(m, OPT_IMPORT_STAR); +    PyModule_AddIntMacro(m, OPT_TOPLEVEL); -    PyModule_AddIntConstant(m, "LOCAL", LOCAL); -    PyModule_AddIntConstant(m, "GLOBAL_EXPLICIT", GLOBAL_EXPLICIT); -    PyModule_AddIntConstant(m, "GLOBAL_IMPLICIT", GLOBAL_IMPLICIT); -    PyModule_AddIntConstant(m, "FREE", FREE); -    PyModule_AddIntConstant(m, "CELL", CELL); +    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_AddIntConstant(m, "SCOPE_MASK", SCOPE_MASK); +    PyModule_AddIntMacro(m, SCOPE_MASK);      if (PyErr_Occurred()) {          Py_DECREF(m); | 
