summaryrefslogtreecommitdiffstats
path: root/Lib/urllib.py
diff options
context:
space:
mode:
authorCollin Winter <collinw@gmail.com>2007-08-31 00:04:24 (GMT)
committerCollin Winter <collinw@gmail.com>2007-08-31 00:04:24 (GMT)
commit828f04ac3f0dd3b68b4dbf42a79ebb846d1de568 (patch)
tree21e25d3d969ce636c32539e4d4b5255dc4c85702 /Lib/urllib.py
parent150b7d7d02eca6970d792f3e6887f957a36b6ca2 (diff)
downloadcpython-828f04ac3f0dd3b68b4dbf42a79ebb846d1de568.zip
cpython-828f04ac3f0dd3b68b4dbf42a79ebb846d1de568.tar.gz
cpython-828f04ac3f0dd3b68b4dbf42a79ebb846d1de568.tar.bz2
Issue #1066: implement PEP 3109, 2/3 of PEP 3134.
Diffstat (limited to 'Lib/urllib.py')
-rw-r--r--Lib/urllib.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/urllib.py b/Lib/urllib.py
index 67f457d..a1e26f0 100644
--- a/Lib/urllib.py
+++ b/Lib/urllib.py
@@ -199,7 +199,7 @@ class URLopener:
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."""
@@ -498,7 +498,7 @@ class URLopener:
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."""
@@ -809,7 +809,7 @@ class ftpwrapper:
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')
@@ -1186,7 +1186,7 @@ def urlencode(query,doseq=0):
# 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: