Mercurial > hg
changeset 7008:8fee8ff13d37
use Exception(args)-style raising consistently (py3k compatibility)
author | Peter Ruibal <peter.ruibal@intel.com> |
---|---|
date | Mon, 08 Sep 2008 13:07:00 +0200 |
parents | a6b74fbb5ce0 |
children | 3d54cf97598d |
files | mercurial/byterange.py mercurial/context.py mercurial/dirstate.py mercurial/hgweb/wsgicgi.py mercurial/localrepo.py mercurial/lsprof.py setup.py |
diffstat | 7 files changed, 14 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/byterange.py Mon Sep 08 12:55:46 2008 +0200 +++ b/mercurial/byterange.py Mon Sep 08 13:07:00 2008 +0200 @@ -110,7 +110,7 @@ in self.fo. This includes methods.""" if hasattr(self.fo, name): return getattr(self.fo, name) - raise AttributeError, name + raise AttributeError(name) def tell(self): """Return the position within the range. @@ -257,7 +257,7 @@ def ftp_open(self, req): host = req.get_host() if not host: - raise IOError, ('ftp error', 'no host given') + raise IOError('ftp error', 'no host given') host, port = splitport(host) if port is None: port = ftplib.FTP_PORT @@ -329,7 +329,7 @@ headers = mimetools.Message(sf) return addinfourl(fp, headers, req.get_full_url()) except ftplib.all_errors, msg: - raise IOError, ('ftp error', msg), sys.exc_info()[2] + raise IOError('ftp error', msg), sys.exc_info()[2] def connect_ftp(self, user, passwd, host, port, dirs): fw = ftpwrapper(user, passwd, host, port, dirs) @@ -359,7 +359,7 @@ try: self.ftp.nlst(file) except ftplib.error_perm, reason: - raise IOError, ('ftp error', reason), sys.exc_info()[2] + raise IOError('ftp error', reason), sys.exc_info()[2] # Restore the transfer mode! self.ftp.voidcmd(cmd) # Try to retrieve as a file @@ -373,7 +373,7 @@ fp = RangeableFileObject(fp, (rest,'')) return (fp, retrlen) elif not str(reason).startswith('550'): - raise IOError, ('ftp error', reason), sys.exc_info()[2] + raise IOError('ftp error', reason), sys.exc_info()[2] if not conn: # Set transfer mode to ASCII! self.ftp.voidcmd('TYPE A')
--- a/mercurial/context.py Mon Sep 08 12:55:46 2008 +0200 +++ b/mercurial/context.py Mon Sep 08 13:07:00 2008 +0200 @@ -65,7 +65,7 @@ self._parents = [changectx(self._repo, x) for x in p] return self._parents else: - raise AttributeError, name + raise AttributeError(name) def __contains__(self, key): return key in self._manifest @@ -215,7 +215,7 @@ self._repopath = self._path return self._repopath else: - raise AttributeError, name + raise AttributeError(name) def __nonzero__(self): try: @@ -521,7 +521,7 @@ self._parents = [changectx(self._repo, x) for x in p] return self._parents else: - raise AttributeError, name + raise AttributeError(name) def _buildmanifest(self): """generate a manifest corresponding to the working directory""" @@ -630,7 +630,7 @@ self._filelog = self._repo.file(self._repopath) return self._filelog else: - raise AttributeError, name + raise AttributeError(name) def __nonzero__(self): return True
--- a/mercurial/dirstate.py Mon Sep 08 12:55:46 2008 +0200 +++ b/mercurial/dirstate.py Mon Sep 08 13:07:00 2008 +0200 @@ -97,7 +97,7 @@ self.normalize = lambda x: x return self.normalize else: - raise AttributeError, name + raise AttributeError(name) def _join(self, f): # much faster than os.path.join()
--- a/mercurial/hgweb/wsgicgi.py Mon Sep 08 12:55:46 2008 +0200 +++ b/mercurial/hgweb/wsgicgi.py Mon Sep 08 13:07:00 2008 +0200 @@ -53,7 +53,7 @@ try: if headers_sent: # Re-raise original exception if headers sent - raise exc_info[0], exc_info[1], exc_info[2] + raise exc_info[0](exc_info[1], exc_info[2]) finally: exc_info = None # avoid dangling circular ref elif headers_set:
--- a/mercurial/localrepo.py Mon Sep 08 12:55:46 2008 +0200 +++ b/mercurial/localrepo.py Mon Sep 08 13:07:00 2008 +0200 @@ -96,7 +96,7 @@ self.dirstate = dirstate.dirstate(self.opener, self.ui, self.root) return self.dirstate else: - raise AttributeError, name + raise AttributeError(name) def __getitem__(self, changeid): if changeid == None:
--- a/mercurial/lsprof.py Mon Sep 08 12:55:46 2008 +0200 +++ b/mercurial/lsprof.py Mon Sep 08 13:07:00 2008 +0200 @@ -25,7 +25,7 @@ def sort(self, crit="inlinetime"): """XXX docstring""" if crit not in profiler_entry.__dict__: - raise ValueError, "Can't sort by %s" % crit + raise ValueError("Can't sort by %s" % crit) self.data.sort(lambda b, a: cmp(getattr(a, crit), getattr(b, crit))) for e in self.data:
--- a/setup.py Mon Sep 08 12:55:46 2008 +0200 +++ b/setup.py Mon Sep 08 13:07:00 2008 +0200 @@ -7,7 +7,7 @@ import sys if not hasattr(sys, 'version_info') or sys.version_info < (2, 3, 0, 'final'): - raise SystemExit, "Mercurial requires python 2.3 or later." + raise SystemExit("Mercurial requires python 2.3 or later.") import os import shutil