Mercurial > hg
changeset 11567:34cc8b84407f
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.
author | Renato Cunha <renatoc@gmail.com> |
---|---|
date | Wed, 14 Jul 2010 23:03:21 -0300 |
parents | 4d11fde55cc5 |
children | d5d4e6a30613 |
files | hgext/bugzilla.py hgext/inotify/client.py hgext/inotify/linuxserver.py hgext/inotify/server.py mercurial/httprepo.py |
diffstat | 5 files changed, 14 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/bugzilla.py Wed Jul 14 22:59:57 2010 -0300 +++ b/hgext/bugzilla.py Wed Jul 14 23:03:21 2010 -0300 @@ -437,5 +437,5 @@ bz.update(id, ctx) bz.notify(ids, util.email(ctx.user())) except MySQLdb.MySQLError, err: - raise util.Abort(_('database error: %s') % err[1]) + raise util.Abort(_('database error: %s') % err.args[1])
--- a/hgext/inotify/client.py Wed Jul 14 22:59:57 2010 -0300 +++ b/hgext/inotify/client.py Wed Jul 14 23:03:21 2010 -0300 @@ -27,11 +27,11 @@ except (OSError, socket.error), err: autostart = self.ui.configbool('inotify', 'autostart', True) - if err[0] == errno.ECONNREFUSED: + if err.args[0] == errno.ECONNREFUSED: self.ui.warn(_('inotify-client: found dead inotify server ' 'socket; removing it\n')) os.unlink(os.path.join(self.root, '.hg', 'inotify.sock')) - if err[0] in (errno.ECONNREFUSED, errno.ENOENT) and autostart: + if err.args[0] in (errno.ECONNREFUSED, errno.ENOENT) and autostart: self.ui.debug('(starting inotify server)\n') try: try: @@ -49,13 +49,13 @@ return function(self, *args) except socket.error, err: self.ui.warn(_('inotify-client: could not talk to new ' - 'inotify server: %s\n') % err[-1]) - elif err[0] in (errno.ECONNREFUSED, errno.ENOENT): + 'inotify server: %s\n') % err.args[-1]) + elif err.args[0] in (errno.ECONNREFUSED, errno.ENOENT): # silently ignore normal errors if autostart is False self.ui.debug('(inotify server not running)\n') else: self.ui.warn(_('inotify-client: failed to contact inotify ' - 'server: %s\n') % err[-1]) + 'server: %s\n') % err.args[-1]) self.ui.traceback() raise QueryFailed('inotify query failed') @@ -75,7 +75,7 @@ try: self.sock.connect(sockpath) except socket.error, err: - if err[0] == "AF_UNIX path too long": + if err.args[0] == "AF_UNIX path too long": sockpath = os.readlink(sockpath) self.sock.connect(sockpath) else:
--- a/hgext/inotify/linuxserver.py Wed Jul 14 22:59:57 2010 -0300 +++ b/hgext/inotify/linuxserver.py Wed Jul 14 23:03:21 2010 -0300 @@ -117,7 +117,7 @@ try: events = cls.poll.poll(timeout) except select.error, err: - if err[0] == errno.EINTR: + if err.args[0] == errno.EINTR: continue raise if events:
--- a/hgext/inotify/server.py Wed Jul 14 22:59:57 2010 -0300 +++ b/hgext/inotify/server.py Wed Jul 14 23:03:21 2010 -0300 @@ -336,10 +336,10 @@ try: self.sock.bind(self.sockpath) except socket.error, err: - if err[0] == errno.EADDRINUSE: + if err.args[0] == errno.EADDRINUSE: raise AlreadyStartedException(_('cannot start: socket is ' 'already bound')) - if err[0] == "AF_UNIX path too long": + if err.args[0] == "AF_UNIX path too long": if os.path.islink(self.sockpath) and \ not os.path.exists(self.sockpath): raise util.Abort('inotify-server: cannot start: ' @@ -437,7 +437,7 @@ finally: sock.shutdown(socket.SHUT_WR) except socket.error, err: - if err[0] != errno.EPIPE: + if err.args[0] != errno.EPIPE: raise if sys.platform == 'linux2':
--- a/mercurial/httprepo.py Wed Jul 14 22:59:57 2010 -0300 +++ b/mercurial/httprepo.py Wed Jul 14 23:03:21 2010 -0300 @@ -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)