diff options
author | Guido van Rossum <guido@python.org> | 1996-11-20 22:02:24 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1996-11-20 22:02:24 (GMT) |
commit | 3c8484e866fb9a8a1c26a253adc414f682861fc3 (patch) | |
tree | b8507cbadb05cc7d2498848b9ef172c0b1cb1d34 /Lib | |
parent | 3ffc5036826a50b89d0b57700806c98230b5127c (diff) | |
download | cpython-3c8484e866fb9a8a1c26a253adc414f682861fc3.zip cpython-3c8484e866fb9a8a1c26a253adc414f682861fc3.tar.gz cpython-3c8484e866fb9a8a1c26a253adc414f682861fc3.tar.bz2 |
When re-raising an exception raised by a module used internally as
IOError, keep the traceback.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/urllib.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Lib/urllib.py b/Lib/urllib.py index 59b3274..2583089 100644 --- a/Lib/urllib.py +++ b/Lib/urllib.py @@ -18,6 +18,7 @@ import string import socket import regex import os +import sys __version__ = '1.5' @@ -130,7 +131,7 @@ class URLopener: try: return getattr(self, name)(url) except socket.error, msg: - raise IOError, ('socket error', msg) + raise IOError, ('socket error', msg), sys.exc_traceback # Overridable interface to open unknown URL type def open_unknown(self, fullurl): @@ -296,7 +297,7 @@ class URLopener: return addinfourl(self.ftpcache[key].retrfile(file, type), noheaders(), self.openedurl) except ftperrors(), msg: - raise IOError, ('ftp error', msg) + raise IOError, ('ftp error', msg), sys.exc_traceback # Derived class with handlers for errors we can handle (perhaps) @@ -465,7 +466,8 @@ class ftpwrapper: conn = self.ftp.transfercmd(cmd) except ftplib.error_perm, reason: if reason[:3] != '550': - raise IOError, ('ftp error', reason) + raise IOError, ('ftp error', reason), \ + sys.exc_traceback if not conn: # Try a directory listing if file: cmd = 'LIST ' + file |