# HG changeset patch # User Yuya Nishihara # Date 2017-10-02 05:52:10 # Node ID b09b3eaf9c969f900339943988c5930dc6768e40 # Parent 50788d1ae6cc52c0722222e1a17f583d515ee449 py3: work around the scope of exception variable in dispatch.run() https://stackoverflow.com/questions/29268892/ diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py --- a/mercurial/dispatch.py +++ b/mercurial/dispatch.py @@ -79,12 +79,14 @@ def run(): 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: