python/dist/src/Python newcompile.c, 1.1.2.67, 1.1.2.68

Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23400/Python Modified Files: Tag: ast-branch newcompile.c Log Message: Cleanup, remove unused u_exit and unneeded u_tmp Index: newcompile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/newcompile.c,v retrieving revision 1.1.2.67 retrieving revision 1.1.2.68 diff -C2 -d -r1.1.2.67 -r1.1.2.68 *** newcompile.c 27 Jan 2004 19:40:18 -0000 1.1.2.67 --- newcompile.c 27 Jan 2004 22:49:04 -0000 1.1.2.68 *************** *** 24,29 **** Inappropriate Exceptions: ! #: problem with cell objects (see test_builtins::test_map) ! (closures need to be fully implemented) #: x = [1] ; x[0] += 1 raises TypeError: object does not support item assignment --- 24,28 ---- Inappropriate Exceptions: ! #: problem with cell objects (closures still have bugs) #: x = [1] ; x[0] += 1 raises TypeError: object does not support item assignment *************** *** 85,90 **** int u_curblock; /* index of current block in u_blocks */ int u_tmpname; /* temporary variables for list comps */ - identifier u_tmp; /* name for u_tmpname */ - struct basicblock u_exit; struct basicblock **u_blocks; --- 84,87 ---- *************** *** 1127,1131 **** case EXCEPT: case FINALLY_TRY: ! while (--i > 0 && c->u->u_fblock[i].fb_type != LOOP) ; if (i == -1) --- 1124,1128 ---- case EXCEPT: case FINALLY_TRY: ! while (--i >= 0 && c->u->u_fblock[i].fb_type != LOOP) ; if (i == -1) *************** *** 1856,1867 **** static int ! compiler_listcomp_generator(struct compiler *c, asdl_seq *generators, int gen_index, expr_ty elt) { - /* need to capture u_tmp here for nested list comps, - u_tmp is set to NULL in compiler_listcomp */ - PyObject *u_tmp = c->u->u_tmp; - /* generate code for the iterator, then each of the ifs, and then write to the element */ --- 1853,1860 ---- static int ! compiler_listcomp_generator(struct compiler *c, PyObject *tmpname, asdl_seq *generators, int gen_index, expr_ty elt) { /* generate code for the iterator, then each of the ifs, and then write to the element */ *************** *** 1897,1906 **** if (++gen_index < asdl_seq_LEN(generators)) ! if (!compiler_listcomp_generator(c, generators, gen_index, elt)) return 0; /* only append after the last for generator */ if (gen_index >= asdl_seq_LEN(generators)) { ! if (!compiler_nameop(c, u_tmp, Load)) return 0; VISIT(c, expr, elt); --- 1890,1900 ---- if (++gen_index < asdl_seq_LEN(generators)) ! if (!compiler_listcomp_generator(c, tmpname, ! generators, gen_index, elt)) return 0; /* only append after the last for generator */ if (gen_index >= asdl_seq_LEN(generators)) { ! if (!compiler_nameop(c, tmpname, Load)) return 0; VISIT(c, expr, elt); *************** *** 1920,1924 **** /* delete the append method added to locals */ if (gen_index == 1) ! if (!compiler_nameop(c, u_tmp, Del)) return 0; --- 1914,1918 ---- /* delete the append method added to locals */ if (gen_index == 1) ! if (!compiler_nameop(c, tmpname, Del)) return 0; *************** *** 1931,1934 **** --- 1925,1929 ---- char tmpname[256]; identifier tmp; + int rc = 0; static identifier append; asdl_seq *generators = e->v.ListComp.generators; *************** *** 1947,1957 **** ADDOP(c, DUP_TOP); ADDOP_O(c, LOAD_ATTR, append, names); ! if (!compiler_nameop(c, tmp, Store)) ! return 0; ! c->u->u_tmp = tmp; ! if (!compiler_listcomp_generator(c, generators, 0, e->v.ListComp.elt)) ! return 0; ! c->u->u_tmp = NULL; ! return 1; } --- 1942,1950 ---- ADDOP(c, DUP_TOP); ADDOP_O(c, LOAD_ATTR, append, names); ! if (compiler_nameop(c, tmp, Store)) ! rc = compiler_listcomp_generator(c, tmp, generators, 0, ! e->v.ListComp.elt); ! Py_DECREF(tmp); ! return rc; }
participants (1)
-
nnorwitz@projects.sourceforge.net