# HG changeset patch # User paulb@jeremy # Date 1154386582 -7200 # Node ID 5795b85355ef5762153dd5899573011f7eec08a9 # Parent 52fb7135229b76b90ba5aee273e200b3f64ecf4d Fixed handler attribute visiting in fixnames, along with some incorrectly defined code attributes. diff -r 52fb7135229b -r 5795b85355ef fixnames.py --- a/fixnames.py Mon Jul 31 21:20:33 2006 +0200 +++ b/fixnames.py Tue Aug 01 00:56:22 2006 +0200 @@ -94,11 +94,11 @@ value = getattr(node, attr, None) if value is not None: setattr(node, attr, self.dispatches(value)) - for attr in ("expr", "lvalue", "test", "handler", "star", "dstar"): + for attr in ("expr", "lvalue", "test", "star", "dstar"): value = getattr(node, attr, None) if value is not None: setattr(node, attr, self.dispatch(value)) - for attr in ("body", "else_", "finally_", "code", "choices"): + for attr in ("body", "else_", "handler", "finally_", "code", "choices"): value = getattr(node, attr, None) if value is not None: setattr(node, attr, self.dispatches(value)) diff -r 52fb7135229b -r 5795b85355ef simplify.py --- a/simplify.py Mon Jul 31 21:20:33 2006 +0200 +++ b/simplify.py Tue Aug 01 00:56:22 2006 +0200 @@ -831,7 +831,7 @@ # Finish the subprogram definition. - subprogram.code = test + subprogram.code = [test] self.current_subprograms.pop() self.subprograms.append(subprogram) @@ -875,13 +875,14 @@ # Wrap the assignment in a try...except statement. try_except = Try(body=[], else_=[], finally_=[]) - try_except.handler = Conditional( + test = Conditional( test=Invoke( expr=LoadName(name="isinstance"), args=[LoadExc(), LoadName(name="StopIteration")], star=None, dstar=None ), body=else_stmt, else_=[Raise(expr=LoadExc())]) + try_except.handler = [test] assign = Assign() assign.code = [