[Python-checkins] python/dist/src/Python compile.c,2.362,2.363
nascheme@users.sourceforge.net
nascheme at users.sourceforge.net
Tue Oct 25 08:30:19 CEST 2005
- Previous message: [Python-checkins] python/dist/src/Lib/encodings cp037.py, 1.6, 1.7 cp1006.py, 1.6, 1.7 cp1026.py, 1.6, 1.7 cp1140.py, 1.3, 1.4 cp1250.py, 1.6, 1.7 cp1251.py, 1.6, 1.7 cp1252.py, 1.6, 1.7 cp1253.py, 1.6, 1.7 cp1254.py, 1.6, 1.7 cp1255.py, 1.6, 1.7 cp1256.py, 1.6, 1.7 cp1257.py, 1.6, 1.7 cp1258.py, 1.6, 1.7 cp424.py, 1.6, 1.7 cp500.py, 1.6, 1.7 cp856.py, 1.7, 1.8 cp874.py, 1.6, 1.7 cp875.py, 1.6, 1.7 iso8859_1.py, 1.6, 1.7 iso8859_10.py, 1.6, 1.7 iso8859_11.py, 1.4, 1.5 iso8859_13.py, 1.6, 1.7 iso8859_14.py, 1.6, 1.7 iso8859_15.py, 1.6, 1.7 iso8859_16.py, 1.4, 1.5 iso8859_2.py, 1.6, 1.7 iso8859_3.py, 1.6, 1.7 iso8859_4.py, 1.6, 1.7 iso8859_5.py, 1.6, 1.7 iso8859_6.py, 1.6, 1.7 iso8859_7.py, 1.6, 1.7 iso8859_8.py, 1.6, 1.7 iso8859_9.py, 1.6, 1.7 koi8_r.py, 1.6, 1.7 koi8_u.py, 1.3, 1.4 mac_centeuro.py, 1.2, 1.3 mac_croatian.py, 1.2, 1.3 mac_cyrillic.py, 1.6, 1.7 mac_farsi.py, 1.2, 1.3 mac_greek.py, 1.6, 1.7 mac_iceland.py, 1.6, 1.7 mac_roman.py, 1.6, 1.7 mac_romanian.py, 1.2, 1.3 mac_turkish.py, 1.6, 1.7 tis_620.py, 1.3, 1.4
- Next message: [Python-checkins] python/dist/src/Python ast.c,2.4,2.5
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/python/python/dist/src/Python
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24488/Python
Modified Files:
compile.c
Log Message:
Ensure that compiler_exit_scope() is called as necessary to free memory
allocated by compiler_enter_scope(). Change return type for
compiler_exit_scope() to be void.
Index: compile.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v
retrieving revision 2.362
retrieving revision 2.363
diff -u -d -r2.362 -r2.363
--- compile.c 23 Oct 2005 23:00:41 -0000 2.362
+++ compile.c 25 Oct 2005 06:30:14 -0000 2.363
@@ -1113,7 +1113,7 @@
return 1;
}
-static int
+static void
compiler_exit_scope(struct compiler *c)
{
int n;
@@ -1126,14 +1126,14 @@
if (n >= 0) {
wrapper = PyList_GET_ITEM(c->c_stack, n);
c->u = (struct compiler_unit *)PyCObject_AsVoidPtr(wrapper);
+ /* we are deleting from a list so this really shouldn't fail */
if (PySequence_DelItem(c->c_stack, n) < 0)
- return 0;
+ Py_FatalError("compiler_exit_scope()");
compiler_unit_check(c->u);
}
else
c->u = NULL;
- return 1; /* XXX void? */
}
/* Allocate a new block and return a pointer to it.
@@ -1701,8 +1701,10 @@
return NULL;
switch (mod->kind) {
case Module_kind:
- if (!compiler_body(c, mod->v.Module.body))
+ if (!compiler_body(c, mod->v.Module.body)) {
+ compiler_exit_scope(c);
return 0;
+ }
break;
case Interactive_kind:
c->c_interactive = 1;
@@ -1872,8 +1874,10 @@
docstring = compiler_isdocstring(st);
if (docstring)
first_const = st->v.Expr.value->v.Str.s;
- if (compiler_add_o(c, c->u->u_consts, first_const) < 0)
+ if (compiler_add_o(c, c->u->u_consts, first_const) < 0) {
+ compiler_exit_scope(c);
return 0;
+ }
/* unpack nested arguments */
compiler_arguments(c, args);
@@ -1889,9 +1893,9 @@
VISIT(c, stmt, s2);
}
co = assemble(c, 1);
+ compiler_exit_scope(c);
if (co == NULL)
return 0;
- compiler_exit_scope(c);
compiler_make_closure(c, co, asdl_seq_LEN(args->defaults));
@@ -1923,6 +1927,7 @@
str = PyString_InternFromString("__name__");
if (!str || !compiler_nameop(c, str, Load)) {
Py_XDECREF(str);
+ compiler_exit_scope(c);
return 0;
}
@@ -1930,19 +1935,22 @@
str = PyString_InternFromString("__module__");
if (!str || !compiler_nameop(c, str, Store)) {
Py_XDECREF(str);
+ compiler_exit_scope(c);
return 0;
}
Py_DECREF(str);
- if (!compiler_body(c, s->v.ClassDef.body))
+ if (!compiler_body(c, s->v.ClassDef.body)) {
+ compiler_exit_scope(c);
return 0;
+ }
ADDOP(c, LOAD_LOCALS);
ADDOP(c, RETURN_VALUE);
co = assemble(c, 1);
+ compiler_exit_scope(c);
if (co == NULL)
return 0;
- compiler_exit_scope(c);
compiler_make_closure(c, co, 0);
ADDOP_I(c, CALL_FUNCTION, 0);
@@ -1976,9 +1984,9 @@
VISIT(c, expr, e->v.Lambda.body);
ADDOP(c, RETURN_VALUE);
co = assemble(c, 1);
+ compiler_exit_scope(c);
if (co == NULL)
return 0;
- compiler_exit_scope(c);
compiler_make_closure(c, co, asdl_seq_LEN(args->defaults));
Py_DECREF(name);
@@ -3149,9 +3157,9 @@
compiler_genexp_generator(c, e->v.GeneratorExp.generators, 0,
e->v.GeneratorExp.elt);
co = assemble(c, 1);
+ compiler_exit_scope(c);
if (co == NULL)
return 0;
- compiler_exit_scope(c);
compiler_make_closure(c, co, 0);
VISIT(c, expr, outermost_iter);
- Previous message: [Python-checkins] python/dist/src/Lib/encodings cp037.py, 1.6, 1.7 cp1006.py, 1.6, 1.7 cp1026.py, 1.6, 1.7 cp1140.py, 1.3, 1.4 cp1250.py, 1.6, 1.7 cp1251.py, 1.6, 1.7 cp1252.py, 1.6, 1.7 cp1253.py, 1.6, 1.7 cp1254.py, 1.6, 1.7 cp1255.py, 1.6, 1.7 cp1256.py, 1.6, 1.7 cp1257.py, 1.6, 1.7 cp1258.py, 1.6, 1.7 cp424.py, 1.6, 1.7 cp500.py, 1.6, 1.7 cp856.py, 1.7, 1.8 cp874.py, 1.6, 1.7 cp875.py, 1.6, 1.7 iso8859_1.py, 1.6, 1.7 iso8859_10.py, 1.6, 1.7 iso8859_11.py, 1.4, 1.5 iso8859_13.py, 1.6, 1.7 iso8859_14.py, 1.6, 1.7 iso8859_15.py, 1.6, 1.7 iso8859_16.py, 1.4, 1.5 iso8859_2.py, 1.6, 1.7 iso8859_3.py, 1.6, 1.7 iso8859_4.py, 1.6, 1.7 iso8859_5.py, 1.6, 1.7 iso8859_6.py, 1.6, 1.7 iso8859_7.py, 1.6, 1.7 iso8859_8.py, 1.6, 1.7 iso8859_9.py, 1.6, 1.7 koi8_r.py, 1.6, 1.7 koi8_u.py, 1.3, 1.4 mac_centeuro.py, 1.2, 1.3 mac_croatian.py, 1.2, 1.3 mac_cyrillic.py, 1.6, 1.7 mac_farsi.py, 1.2, 1.3 mac_greek.py, 1.6, 1.7 mac_iceland.py, 1.6, 1.7 mac_roman.py, 1.6, 1.7 mac_romanian.py, 1.2, 1.3 mac_turkish.py, 1.6, 1.7 tis_620.py, 1.3, 1.4
- Next message: [Python-checkins] python/dist/src/Python ast.c,2.4,2.5
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Python-checkins
mailing list