[Python-checkins] python/dist/src/Python ast.c,1.1.2.23,1.1.2.24

nnorwitz@users.sourceforge.net nnorwitz@users.sourceforge.net
Tue, 01 Apr 2003 14:17:49 -0800


Update of /cvsroot/python/python/dist/src/Python
In directory sc8-pr-cvs1:/tmp/cvs-serv27840/Python

Modified Files:
      Tag: ast-branch
	ast.c 
Log Message:
fix one memory leak, doc another, still need to fix XXX comments, remove unnecessary breaks

Index: ast.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/Attic/ast.c,v
retrieving revision 1.1.2.23
retrieving revision 1.1.2.24
diff -C2 -d -r1.1.2.23 -r1.1.2.24
*** ast.c	31 Mar 2003 21:40:03 -0000	1.1.2.23
--- ast.c	1 Apr 2003 22:17:47 -0000	1.1.2.24
***************
*** 534,537 ****
--- 534,538 ----
  		    ch = CHILD(ch, 2);
  	    }
+ 	    /* XXX ifs is leaked, we surely have to do something with it */
  	    /* on exit, must guarantee that ch is a list_for */
  	    if (TYPE(ch) == list_iter)
***************
*** 770,780 ****
  	case PLUS:
  	    return UnaryOp(UAdd, ast_for_expr(CHILD(n, 1)));
- 	    break;
  	case MINUS:
  	    return UnaryOp(USub, ast_for_expr(CHILD(n, 1)));
- 	    break;
  	case TILDE:
  	    return UnaryOp(Invert, ast_for_expr(CHILD(n, 1)));
- 	    break;
  	}
  	break;
--- 771,778 ----
***************
*** 820,824 ****
  	}
  	return e;
- 	break;
      }
      default:
--- 818,821 ----
***************
*** 1106,1113 ****
      } else if (STR(CHILD(n, 0))[0] == 'f') { /* from */
  	alias_ty mod = alias_for_import_name(CHILD(n, 1));
  	aliases = asdl_seq_new((NCH(n) - 2) / 2);
  	for (i = 3; i <= NCH(n); i += 2)
  	    asdl_seq_APPEND(aliases, alias_for_import_name(CHILD(n, i)));
! 	return ImportFrom(mod->name, aliases, LINENO(n));
      }
      return NULL;
--- 1103,1115 ----
      } else if (STR(CHILD(n, 0))[0] == 'f') { /* from */
  	alias_ty mod = alias_for_import_name(CHILD(n, 1));
+ 	stmt_ty import;
  	aliases = asdl_seq_new((NCH(n) - 2) / 2);
  	for (i = 3; i <= NCH(n); i += 2)
  	    asdl_seq_APPEND(aliases, alias_for_import_name(CHILD(n, i)));
! 	import = ImportFrom(mod->name, aliases, LINENO(n));
! 	/* XXX we should probably not be using PyObject_Free directly
! 	       should we use asdl_seq_free?  we need to cast if so */
! 	PyObject_Free(mod);
! 	return import;
      }
      return NULL;