changeset 34532:b09b3eaf9c96

py3: work around the scope of exception variable in dispatch.run() https://stackoverflow.com/questions/29268892/
author Yuya Nishihara <yuya@tcha.org>
date Mon, 02 Oct 2017 06:52:10 +0100
parents 50788d1ae6cc
children 163fa0aea71e
files mercurial/dispatch.py
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/dispatch.py	Sat Oct 07 22:07:10 2017 +0900
+++ b/mercurial/dispatch.py	Mon Oct 02 06:52:10 2017 +0100
@@ -79,12 +79,14 @@
     err = None
     try:
         status = (dispatch(req) or 0) & 255
-    except error.StdioError as err:
+    except error.StdioError as e:
+        err = e
         status = -1
     if util.safehasattr(req.ui, 'fout'):
         try:
             req.ui.fout.flush()
-        except IOError as err:
+        except IOError as e:
+            err = e
             status = -1
     if util.safehasattr(req.ui, 'ferr'):
         if err is not None and err.errno != errno.EPIPE: