[Python-checkins] python/dist/src/Python symtable.c, 2.10.8.32,
2.10.8.33
bcannon at users.sourceforge.net
bcannon at users.sourceforge.net
Tue Apr 19 21:05:32 CEST 2005
Update of /cvsroot/python/python/dist/src/Python
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2582/Python
Modified Files:
Tag: ast-branch
symtable.c
Log Message:
Fix detection of when a variable is a free or local variable.
Closes bug #1166714. Thanks John Ehresman.
Index: symtable.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/symtable.c,v
retrieving revision 2.10.8.32
retrieving revision 2.10.8.33
diff -u -d -r2.10.8.32 -r2.10.8.33
--- symtable.c 13 Apr 2005 19:44:40 -0000 2.10.8.32
+++ symtable.c 19 Apr 2005 19:05:14 -0000 2.10.8.33
@@ -510,7 +510,7 @@
PyObject *global)
{
PyObject *name, *v, *local = NULL, *scope = NULL, *newbound = NULL;
- PyObject *newglobal = NULL;
+ PyObject *newglobal = NULL, *newfree = NULL;
int i, flags, pos = 0, success = 0;
local = PyDict_New();
@@ -522,6 +522,9 @@
newglobal = PyDict_New();
if (!newglobal)
goto error;
+ newfree = PyDict_New();
+ if (!newfree)
+ goto error;
newbound = PyDict_New();
if (!newbound)
goto error;
@@ -563,22 +566,26 @@
for (i = 0; i < PyList_GET_SIZE(ste->ste_children); ++i) {
PyObject *c = PyList_GET_ITEM(ste->ste_children, i);
assert(c && PySTEntry_Check(c));
- if (!analyze_block((PySTEntryObject *)c, newbound, free,
+ if (!analyze_block((PySTEntryObject *)c, newbound, newfree,
newglobal))
goto error;
}
- if (ste->ste_type == FunctionBlock && !analyze_cells(scope, free))
+ if (ste->ste_type == FunctionBlock && !analyze_cells(scope, newfree))
goto error;
- if (!update_symbols(ste->ste_symbols, scope, bound, free,
+ if (!update_symbols(ste->ste_symbols, scope, bound, newfree,
ste->ste_type == ClassBlock))
goto error;
+
+ if (PyDict_Update(free, newfree) < 0)
+ goto error;
success = 1;
error:
Py_XDECREF(local);
Py_XDECREF(scope);
Py_XDECREF(newbound);
Py_XDECREF(newglobal);
+ Py_XDECREF(newfree);
if (!success)
assert(PyErr_Occurred());
return success;
More information about the Python-checkins
mailing list