mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
Don't add global names to st->st_global if we're already iterating
over the elements of st->st_global!
This commit is contained in:
parent
cd81ea1708
commit
5125773ff1
1 changed files with 15 additions and 6 deletions
|
@ -3975,10 +3975,16 @@ get_ref_type(struct compiling *c, char *name)
|
||||||
{
|
{
|
||||||
char buf[350];
|
char buf[350];
|
||||||
sprintf(buf,
|
sprintf(buf,
|
||||||
"unknown scope for %.100s in %.100s(%s) in %s",
|
"unknown scope for %.100s in %.100s(%s) "
|
||||||
|
"in %s\nsymbols: %s\nlocals: %s\nglobals: %s\n",
|
||||||
name, c->c_name,
|
name, c->c_name,
|
||||||
PyObject_REPR(c->c_symtable->st_cur->ste_id),
|
PyObject_REPR(c->c_symtable->st_cur->ste_id),
|
||||||
c->c_filename);
|
c->c_filename,
|
||||||
|
PyObject_REPR(c->c_symtable->st_cur->ste_symbols),
|
||||||
|
PyObject_REPR(c->c_locals),
|
||||||
|
PyObject_REPR(c->c_globals)
|
||||||
|
);
|
||||||
|
|
||||||
Py_FatalError(buf);
|
Py_FatalError(buf);
|
||||||
}
|
}
|
||||||
return -1; /* can't get here */
|
return -1; /* can't get here */
|
||||||
|
@ -4330,10 +4336,13 @@ symtable_load_symbols(struct compiling *c)
|
||||||
if (PyDict_SetItem(c->c_globals, name,
|
if (PyDict_SetItem(c->c_globals, name,
|
||||||
implicit) < 0)
|
implicit) < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
v = PyInt_FromLong(flags);
|
if (st->st_nscopes != 1) {
|
||||||
if (PyDict_SetItem(st->st_global, name, v))
|
v = PyInt_FromLong(flags);
|
||||||
goto fail;
|
if (PyDict_SetItem(st->st_global,
|
||||||
Py_DECREF(v);
|
name, v))
|
||||||
|
goto fail;
|
||||||
|
Py_DECREF(v);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue