mirror of
https://github.com/python/cpython.git
synced 2025-09-13 12:17:24 +00:00
SF # 654960, remove unnecessary static variable
The static variable (implicit) was not necessary. The c_globals can be None or True now.
This commit is contained in:
parent
1795f29b4b
commit
06982221bb
1 changed files with 3 additions and 9 deletions
|
@ -456,7 +456,7 @@ struct compiling {
|
||||||
PyObject *c_const_dict; /* inverse of c_consts */
|
PyObject *c_const_dict; /* inverse of c_consts */
|
||||||
PyObject *c_names; /* list of strings (names) */
|
PyObject *c_names; /* list of strings (names) */
|
||||||
PyObject *c_name_dict; /* inverse of c_names */
|
PyObject *c_name_dict; /* inverse of c_names */
|
||||||
PyObject *c_globals; /* dictionary (value=None) */
|
PyObject *c_globals; /* dictionary (value=None or True) */
|
||||||
PyObject *c_locals; /* dictionary (value=localID) */
|
PyObject *c_locals; /* dictionary (value=localID) */
|
||||||
PyObject *c_varnames; /* list (inverse of c_locals) */
|
PyObject *c_varnames; /* list (inverse of c_locals) */
|
||||||
PyObject *c_freevars; /* dictionary (value=None) */
|
PyObject *c_freevars; /* dictionary (value=None) */
|
||||||
|
@ -4658,18 +4658,12 @@ symtable_update_flags(struct compiling *c, PySymtableEntryObject *ste,
|
||||||
static int
|
static int
|
||||||
symtable_load_symbols(struct compiling *c)
|
symtable_load_symbols(struct compiling *c)
|
||||||
{
|
{
|
||||||
static PyObject *implicit = NULL;
|
|
||||||
struct symtable *st = c->c_symtable;
|
struct symtable *st = c->c_symtable;
|
||||||
PySymtableEntryObject *ste = st->st_cur;
|
PySymtableEntryObject *ste = st->st_cur;
|
||||||
PyObject *name, *varnames, *v;
|
PyObject *name, *varnames, *v;
|
||||||
int i, flags, pos;
|
int i, flags, pos;
|
||||||
struct symbol_info si;
|
struct symbol_info si;
|
||||||
|
|
||||||
if (implicit == NULL) {
|
|
||||||
implicit = PyInt_FromLong(1);
|
|
||||||
if (implicit == NULL)
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
v = NULL;
|
v = NULL;
|
||||||
|
|
||||||
if (symtable_init_compiling_symbols(c) < 0)
|
if (symtable_init_compiling_symbols(c) < 0)
|
||||||
|
@ -4726,7 +4720,7 @@ symtable_load_symbols(struct compiling *c)
|
||||||
goto fail;
|
goto fail;
|
||||||
} else if (flags & DEF_FREE_GLOBAL) {
|
} else if (flags & DEF_FREE_GLOBAL) {
|
||||||
si.si_nimplicit++;
|
si.si_nimplicit++;
|
||||||
if (PyDict_SetItem(c->c_globals, name, implicit) < 0)
|
if (PyDict_SetItem(c->c_globals, name, Py_True) < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
} else if ((flags & DEF_LOCAL) && !(flags & DEF_PARAM)) {
|
} else if ((flags & DEF_LOCAL) && !(flags & DEF_PARAM)) {
|
||||||
v = PyInt_FromLong(si.si_nlocals++);
|
v = PyInt_FromLong(si.si_nlocals++);
|
||||||
|
@ -4749,7 +4743,7 @@ symtable_load_symbols(struct compiling *c)
|
||||||
} else {
|
} else {
|
||||||
si.si_nimplicit++;
|
si.si_nimplicit++;
|
||||||
if (PyDict_SetItem(c->c_globals, name,
|
if (PyDict_SetItem(c->c_globals, name,
|
||||||
implicit) < 0)
|
Py_True) < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
if (st->st_nscopes != 1) {
|
if (st->st_nscopes != 1) {
|
||||||
v = PyInt_FromLong(flags);
|
v = PyInt_FromLong(flags);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue