heredoctest: 2to3 -w -f numliterals -f except -f print tests/heredoctest.py
authorAugie Fackler <augie@google.com>
Sun, 12 Apr 2015 15:34:17 -0400
changeset 25032 1db2127d2373
parent 25031 0adc22a0b6b3
child 25033 2bdd9e442bcc
heredoctest: 2to3 -w -f numliterals -f except -f print tests/heredoctest.py
tests/heredoctest.py
--- a/tests/heredoctest.py	Sat Apr 11 18:20:44 2015 -0400
+++ b/tests/heredoctest.py	Sun Apr 12 15:34:17 2015 -0400
@@ -5,7 +5,7 @@
 while lines:
     l = lines.pop(0)
     if l.startswith('SALT'):
-        print l[:-1]
+        print(l[:-1])
     elif l.startswith('>>> '):
         snippet = l[4:]
         while lines and lines[0].startswith('... '):
@@ -13,6 +13,6 @@
             snippet += l[4:]
         c = compile(snippet, '<heredoc>', 'single')
         try:
-            exec c in globalvars
-        except Exception, inst:
-            print repr(inst)
+            exec(c, globalvars)
+        except Exception as inst:
+            print(repr(inst))