diff options
| author | shadchin <[email protected]> | 2022-02-10 16:44:39 +0300 |
|---|---|---|
| committer | Daniil Cherednik <[email protected]> | 2022-02-10 16:44:39 +0300 |
| commit | e9656aae26e0358d5378e5b63dcac5c8dbe0e4d0 (patch) | |
| tree | 64175d5cadab313b3e7039ebaa06c5bc3295e274 /contrib/tools/python3/src/Modules/symtablemodule.c | |
| parent | 2598ef1d0aee359b4b6d5fdd1758916d5907d04f (diff) | |
Restoring authorship annotation for <[email protected]>. Commit 2 of 2.
Diffstat (limited to 'contrib/tools/python3/src/Modules/symtablemodule.c')
| -rw-r--r-- | contrib/tools/python3/src/Modules/symtablemodule.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/contrib/tools/python3/src/Modules/symtablemodule.c b/contrib/tools/python3/src/Modules/symtablemodule.c index eb33989acc1..9180f185e1e 100644 --- a/contrib/tools/python3/src/Modules/symtablemodule.c +++ b/contrib/tools/python3/src/Modules/symtablemodule.c @@ -14,7 +14,7 @@ module _symtable /*[clinic input] _symtable.symtable - source: object + source: object filename: object(converter='PyUnicode_FSDecoder') startstr: str / @@ -23,23 +23,23 @@ Return symbol and scope dictionaries used internally by compiler. [clinic start generated code]*/ static PyObject * -_symtable_symtable_impl(PyObject *module, PyObject *source, +_symtable_symtable_impl(PyObject *module, PyObject *source, PyObject *filename, const char *startstr) -/*[clinic end generated code: output=59eb0d5fc7285ac4 input=9dd8a50c0c36a4d7]*/ +/*[clinic end generated code: output=59eb0d5fc7285ac4 input=9dd8a50c0c36a4d7]*/ { struct symtable *st; PyObject *t; int start; - PyCompilerFlags cf = _PyCompilerFlags_INIT; - PyObject *source_copy = NULL; + PyCompilerFlags cf = _PyCompilerFlags_INIT; + PyObject *source_copy = NULL; + + cf.cf_flags = PyCF_SOURCE_IS_UTF8; + + const char *str = _Py_SourceAsString(source, "symtable", "string or bytes", &cf, &source_copy); + if (str == NULL) { + return NULL; + } - cf.cf_flags = PyCF_SOURCE_IS_UTF8; - - const char *str = _Py_SourceAsString(source, "symtable", "string or bytes", &cf, &source_copy); - if (str == NULL) { - return NULL; - } - if (strcmp(startstr, "exec") == 0) start = Py_file_input; else if (strcmp(startstr, "eval") == 0) @@ -50,15 +50,15 @@ _symtable_symtable_impl(PyObject *module, PyObject *source, PyErr_SetString(PyExc_ValueError, "symtable() arg 3 must be 'exec' or 'eval' or 'single'"); Py_DECREF(filename); - Py_XDECREF(source_copy); + Py_XDECREF(source_copy); return NULL; } - st = _Py_SymtableStringObjectFlags(str, filename, start, &cf); + st = _Py_SymtableStringObjectFlags(str, filename, start, &cf); Py_DECREF(filename); - Py_XDECREF(source_copy); - if (st == NULL) { + Py_XDECREF(source_copy); + if (st == NULL) { return NULL; - } + } t = (PyObject *)st->st_top; Py_INCREF(t); PyMem_Free((void *)st->st_future); @@ -96,7 +96,7 @@ PyInit__symtable(void) return NULL; PyModule_AddIntMacro(m, USE); PyModule_AddIntMacro(m, DEF_GLOBAL); - PyModule_AddIntMacro(m, DEF_NONLOCAL); + PyModule_AddIntMacro(m, DEF_NONLOCAL); PyModule_AddIntMacro(m, DEF_LOCAL); PyModule_AddIntMacro(m, DEF_PARAM); PyModule_AddIntMacro(m, DEF_FREE); |
