[PATCH 7 of 9] httprepo: removed exception args indexing (not supported by py3k)

Renato Cunha renatoc at gmail.com
Wed Jul 14 21:18:40 CDT 2010


# HG changeset patch
# User Renato Cunha <renatoc at gmail.com>
# Date 1279160098 10800
# Branch stable
# Node ID 1c3a075e500905c8d9ffeddd92bb6fd00b7c3ae5
# Parent  a943677dcd2fc06048a0d5dafb48e13ed32fc866
httprepo: removed exception args indexing (not supported by py3k)

Py3k removed __getitem__ for exception classes. The correct way of getting the
exception arguments is by using the args method.

diff --git a/mercurial/httprepo.py b/mercurial/httprepo.py
--- a/mercurial/httprepo.py
+++ b/mercurial/httprepo.py
@@ -249,9 +249,9 @@
                     self.ui.status(_('remote: '), l)
                 return ret
             except socket.error, err:
-                if err[0] in (errno.ECONNRESET, errno.EPIPE):
-                    raise util.Abort(_('push failed: %s') % err[1])
-                raise util.Abort(err[1])
+                if err.args[0] in (errno.ECONNRESET, errno.EPIPE):
+                    raise util.Abort(_('push failed: %s') % err.args[1])
+                raise util.Abort(err.args[1])
         finally:
             fp.close()
             os.unlink(tempname)


More information about the Mercurial-devel mailing list