[Python-checkins] r53338 - sandbox/trunk/2to3/fixes/fix_except.py

guido.van.rossum python-checkins at python.org
Wed Jan 10 02:40:18 CET 2007


Author: guido.van.rossum
Date: Wed Jan 10 02:40:17 2007
New Revision: 53338

Modified:
   sandbox/trunk/2to3/fixes/fix_except.py
Log:
Patch by Collin Winter:
Python 2 excepts could take the form except E,V: (no space)
That doesn't work for the new version.


Modified: sandbox/trunk/2to3/fixes/fix_except.py
==============================================================================
--- sandbox/trunk/2to3/fixes/fix_except.py	(original)
+++ sandbox/trunk/2to3/fixes/fix_except.py	Wed Jan 10 02:40:17 2007
@@ -35,7 +35,12 @@
             return node
         
         as_leaf = pytree.Leaf(token.NAME, "as")
-        as_leaf.set_prefix(' ')
+        as_leaf.set_prefix(" ")
+        
+        # Python 2 excepts could take the form except E,V: (no space)
+        # That doesn't work for the new version
+        if not b.get_prefix():
+            b.set_prefix(" ")
         
         new = pytree.Node(syms.except_clause,
                           [pytree.Leaf(token.NAME, "except"),


More information about the Python-checkins mailing list