Patchwork [08,of,11] doctest: upgrade old-style "except" clause

login
register
mail settings
Submitter Yuya Nishihara
Date Sept. 4, 2017, 3:08 p.m.
Message ID <7c2661eb481b2c4110a0.1504537707@mimosa>
Download mbox | patch
Permalink /patch/23663/
State Accepted
Headers show

Comments

Yuya Nishihara - Sept. 4, 2017, 3:08 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1504419361 -32400
#      Sun Sep 03 15:16:01 2017 +0900
# Node ID 7c2661eb481b2c4110a071a26e20e07ab831a175
# Parent  9a8de7f63768bf73e6a6c7e66f8ca43e309a427c
doctest: upgrade old-style "except" clause

Patch

diff --git a/hgext/mq.py b/hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -155,7 +155,7 @@  PLAINHEADERS = {
 def inserthgheader(lines, header, value):
     """Assuming lines contains a HG patch header, add a header line with value.
     >>> try: inserthgheader([], b'# Date ', b'z')
-    ... except ValueError, inst: print("oops")
+    ... except ValueError as inst: print("oops")
     oops
     >>> inserthgheader([b'# HG changeset patch'], b'# Date ', b'z')
     ['# HG changeset patch', '# Date z']
diff --git a/mercurial/dagparser.py b/mercurial/dagparser.py
--- a/mercurial/dagparser.py
+++ b/mercurial/dagparser.py
@@ -157,7 +157,7 @@  def parsedag(desc):
 
         >>> from . import pycompat
         >>> try: list(parsedag(b'+1 bad'))
-        ... except Exception, e: print(pycompat.sysstr(bytes(e)))
+        ... except Exception as e: print(pycompat.sysstr(bytes(e)))
         invalid character in dag description: bad...
 
     '''