r68108 - in sandbox/trunk/2to3/lib2to3: fixer_util.py tests/test_fixers.py
Author: benjamin.peterson Date: Wed Dec 31 19:00:12 2008 New Revision: 68108 Log: don't change long even if it's the only argument name Modified: sandbox/trunk/2to3/lib2to3/fixer_util.py sandbox/trunk/2to3/lib2to3/tests/test_fixers.py Modified: sandbox/trunk/2to3/lib2to3/fixer_util.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixer_util.py (original) +++ sandbox/trunk/2to3/lib2to3/fixer_util.py Wed Dec 31 19:00:12 2008 @@ -236,10 +236,12 @@ if parent.type == syms.expr_stmt and parent.children[0] is node: # Assignment. return False - if parent.type == syms.typedargslist and ( - (prev is not None and prev.type == token.COMMA) or - parent.children[0] is node - ): + if parent.type == syms.parameters or \ + (parent.type == syms.typedargslist and ( + (prev is not None and prev.type == token.COMMA) or + parent.children[0] is node + )): + # The name of an argument. return False return True Modified: sandbox/trunk/2to3/lib2to3/tests/test_fixers.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/tests/test_fixers.py (original) +++ sandbox/trunk/2to3/lib2to3/tests/test_fixers.py Wed Dec 31 19:00:12 2008 @@ -1084,6 +1084,9 @@ s = """class long(): pass""" self.unchanged(s) + s = """def f(long): pass""" + self.unchanged(s) + s = """def f(g, long): pass""" self.unchanged(s)
participants (1)
-
benjamin.peterson