=== Lib/test/test_sys.py ================================================================== --- Lib/test/test_sys.py (revision 980) +++ Lib/test/test_sys.py (local) @@ -119,12 +119,7 @@ # test that the exit machinery handles SystemExits properly import subprocess - # both unnormalized... rc = subprocess.call([sys.executable, "-c", - "raise SystemExit, 46"]) - self.assertEqual(rc, 46) - # ... and normalized - rc = subprocess.call([sys.executable, "-c", "raise SystemExit(47)"]) self.assertEqual(rc, 47) === Lib/os.py =================================================================== --- Lib/os.py (revision 57765) +++ Lib/os.py (working copy) @@ -113,7 +113,7 @@ del ce else: - raise ImportError, 'no os specific module found' + raise ImportError('no os specific module found') sys.modules['os.path'] = path from os.path import curdir, pardir, sep, pathsep, defpath, altsep, devnull @@ -386,8 +386,8 @@ saved_exc = e saved_tb = tb if saved_exc: - raise error, saved_exc, saved_tb - raise error, last_exc, tb + raise error(saved_exc).with_traceback(saved_tb) + raise error(last_exc).with_traceback(tb) # Change environ to automatically call putenv(), unsetenv if they exist. @@ -492,7 +492,7 @@ elif WIFEXITED(sts): return WEXITSTATUS(sts) else: - raise error, "Not stopped, signaled or exited???" + raise error("Not stopped, signaled or exited???") def spawnv(mode, file, args): """spawnv(mode, file, args) -> integer === Lib/doctest.py ================================================================== --- Lib/doctest.py (revision 980) +++ Lib/doctest.py (local) @@ -1608,7 +1608,7 @@ '42\n' >>> exc_info = failure.exc_info - >>> raise exc_info[0], exc_info[1], exc_info[2] + >>> raise exc_info[1] # Already has the traceback Traceback (most recent call last): ... KeyError @@ -2146,7 +2146,7 @@ '42\n' >>> exc_info = failure.exc_info - >>> raise exc_info[0], exc_info[1], exc_info[2] + >>> raise exc_info[1] # Already has the traceback Traceback (most recent call last): ... KeyError === Lib/contextlib.py ================================================================== --- Lib/contextlib.py (revision 980) +++ Lib/contextlib.py (local) @@ -125,7 +125,7 @@ # Don't rely on sys.exc_info() still containing # the right information. Another exception may # have been raised and caught by an exit method - raise exc[0], exc[1], exc[2] + raise exc[0](exc[1]).with_traceback(exc[2]) class closing(object): === Lib/urllib.py ================================================================== --- Lib/urllib.py (revision 980) +++ Lib/urllib.py (local) @@ -191,7 +191,7 @@ else: return getattr(self, name)(url, data) except socket.error as msg: - raise IOError, ('socket error', msg), sys.exc_info()[2] + raise IOError('socket error', msg).with_traceback(sys.exc_info()[2]) def open_unknown(self, fullurl, data=None): """Overridable interface to open unknown URL type.""" @@ -490,7 +490,7 @@ headers = mimetools.Message(StringIO(headers)) return addinfourl(fp, headers, "ftp:" + url) except ftperrors() as msg: - raise IOError, ('ftp error', msg), sys.exc_info()[2] + raise IOError('ftp error', msg).with_traceback(sys.exc_info()[2]) def open_data(self, url, data=None): """Use "data" URL.""" @@ -801,7 +801,7 @@ conn = self.ftp.ntransfercmd(cmd) except ftplib.error_perm as reason: if str(reason)[:3] != '550': - raise IOError, ('ftp error', reason), sys.exc_info()[2] + raise IOError('ftp error', reason).with_traceback(sys.exc_info()[2]) if not conn: # Set transfer mode to ASCII! self.ftp.voidcmd('TYPE A') @@ -1178,7 +1178,7 @@ # preserved for consistency except TypeError: ty,va,tb = sys.exc_info() - raise TypeError, "not a valid non-string sequence or mapping object", tb + raise TypeError("not a valid non-string sequence or mapping object").with_traceback(tb) l = [] if not doseq: === Lib/urllib2.py ================================================================== --- Lib/urllib2.py (revision 980) +++ Lib/urllib2.py (local) @@ -1286,7 +1286,7 @@ headers = mimetools.Message(sf) return addinfourl(fp, headers, req.get_full_url()) except ftplib.all_errors as msg: - raise IOError, ('ftp error', msg), sys.exc_info()[2] + raise IOError('ftp error', msg).with_traceback(sys.exc_info()[2]) def connect_ftp(self, user, passwd, host, port, dirs, timeout): fw = ftpwrapper(user, passwd, host, port, dirs, timeout) === Lib/test/test_with.py ================================================================== --- Lib/test/test_with.py (revision 980) +++ Lib/test/test_with.py (local) @@ -87,7 +87,7 @@ ex = sys.exc_info() self.entered = None if ex is not exc_info: - raise ex[0], ex[1], ex[2] + raise ex[0](ex[1]).with_traceback(ex[2]) class MockNested(Nested): === Lib/test/test_zipimport.py ================================================================== --- Lib/test/test_zipimport.py (revision 980) +++ Lib/test/test_zipimport.py (local) @@ -244,7 +244,7 @@ def get_file(): return __file__ if __loader__.get_data("some.data") != b"some data": - raise AssertionError, "bad data"\n""" + raise AssertionError("bad data")\n""" pyc = make_pyc(compile(src, "", "exec"), NOW) files = {TESTMOD + pyc_ext: (NOW, pyc), "some.data": (NOW, "some data")} === Mac/BuildScript/build-installer.py ================================================================== --- Mac/BuildScript/build-installer.py (revision 980) +++ Mac/BuildScript/build-installer.py (local) @@ -54,7 +54,7 @@ if 'PY_VERSION' in ln: return ln.split()[-1][1:-1] - raise RuntimeError, "Cannot find full version??" + raise RuntimeError("Cannot find full version??") # The directory we'll use to create the build (will be erased and recreated) WORKDIR = "/tmp/_py" @@ -291,7 +291,7 @@ xit = fd.close() if xit != None: sys.stdout.write(data) - raise RuntimeError, "command failed: %s"%(commandline,) + raise RuntimeError("command failed: %s"%(commandline,)) if VERBOSE: sys.stdout.write(data); sys.stdout.flush() @@ -302,7 +302,7 @@ xit = fd.close() if xit != None: sys.stdout.write(data) - raise RuntimeError, "command failed: %s"%(commandline,) + raise RuntimeError("command failed: %s"%(commandline,)) return data @@ -361,7 +361,7 @@ SRCDIR=v else: - raise NotImplementedError, k + raise NotImplementedError(k) SRCDIR=os.path.abspath(SRCDIR) WORKDIR=os.path.abspath(WORKDIR) @@ -418,7 +418,7 @@ xit = fp.close() if xit is not None: sys.stdout.write(data) - raise RuntimeError, "Cannot extract %s"%(archiveName,) + raise RuntimeError("Cannot extract %s"%(archiveName,)) return os.path.join(builddir, retval) === Mac/Tools/Doc/setup.py ================================================================== --- Mac/Tools/Doc/setup.py (revision 980) +++ Mac/Tools/Doc/setup.py (local) @@ -59,7 +59,7 @@ dirname = 'Python-Docs-%s' % self.doc_version if os.path.exists(self.build_html): - raise RuntimeError, '%s: already exists, please remove and try again' % self.build_html + raise RuntimeError('%s: already exists, please remove and try again' % self.build_html) os.chdir(self.build_base) self.spawn('curl','-O', url) self.spawn('tar', '-xjf', tarfile) @@ -146,8 +146,7 @@ self.mkpath(self.build_base) self.ensureHtml() if not os.path.isdir(self.build_html): - raise RuntimeError, \ - "Can't find source folder for documentation." + raise RuntimeError("Can't find source folder for documentation.") self.mkpath(self.build_dest) if dep_util.newer(os.path.join(self.build_html,'index.html'), os.path.join(self.build_dest,'index.html')): self.mkpath(self.build_dest) === Mac/scripts/buildpkg.py ================================================================== --- Mac/scripts/buildpkg.py (revision 980) +++ Mac/scripts/buildpkg.py (local) @@ -194,7 +194,7 @@ if k in fields: self.packageInfo[k] = v elif not k in ["OutputDir"]: - raise Error, "Unknown package option: %s" % k + raise Error("Unknown package option: %s" % k) # Check where we should leave the output. Default is current directory outputdir = options.get("OutputDir", os.getcwd()) === Mac/scripts/mkestrres.py ================================================================== --- Mac/scripts/mkestrres.py (revision 980) +++ Mac/scripts/mkestrres.py (local) @@ -33,7 +33,7 @@ def Pstring(str): if len(str) > 255: - raise ValueError, 'String too large' + raise ValueError('String too large') return chr(len(str))+str def writeestr(dst, edict): === Lib/wsgiref/handlers.py ================================================================== --- Lib/wsgiref/handlers.py (revision 980) +++ Lib/wsgiref/handlers.py (local) @@ -151,7 +151,7 @@ try: if self.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]).with_traceback(exc_info[2]) finally: exc_info = None # avoid dangling circular ref elif self.headers is not None: === Tools/webchecker/webchecker.py ================================================================== --- Tools/webchecker/webchecker.py (revision 980) +++ Tools/webchecker/webchecker.py (local) @@ -267,7 +267,7 @@ def setflags(self, **kw): for key in kw.keys(): if key not in self.validflags: - raise NameError, "invalid keyword argument: %s" % str(key) + raise NameError("invalid keyword argument: %s" % str(key)) for key, value in kw.items(): setattr(self, key, value) @@ -761,7 +761,7 @@ names = os.listdir(path) except os.error as msg: exc_type, exc_value, exc_tb = sys.exc_info() - raise IOError, msg, exc_tb + raise IOError(msg).with_traceback(exc_tb) names.sort() s = MyStringIO("file:"+url, {'content-type': 'text/html'}) s.write('\n' %