diff options
author | Georg Brandl <georg@python.org> | 2006-05-08 17:48:01 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2006-05-08 17:48:01 (GMT) |
commit | e854e765f40a7af814fc9ba0c57b7877eaeb21f9 (patch) | |
tree | 405d86433e6b68a888a7c2234b12582099713dd7 /Lib/_LWPCookieJar.py | |
parent | b5f2e5cc50a5eab06d36e25d7edc137eae454518 (diff) | |
download | cpython-e854e765f40a7af814fc9ba0c57b7877eaeb21f9.zip cpython-e854e765f40a7af814fc9ba0c57b7877eaeb21f9.tar.gz cpython-e854e765f40a7af814fc9ba0c57b7877eaeb21f9.tar.bz2 |
Patch #1478993: take advantage of BaseException/Exception split in cookielib
Diffstat (limited to 'Lib/_LWPCookieJar.py')
-rw-r--r-- | Lib/_LWPCookieJar.py | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/Lib/_LWPCookieJar.py b/Lib/_LWPCookieJar.py index 6d5ce18..76da942 100644 --- a/Lib/_LWPCookieJar.py +++ b/Lib/_LWPCookieJar.py @@ -12,9 +12,10 @@ libwww-perl, I hope. """ import time, re, logging -from cookielib import (reraise_unmasked_exceptions, FileCookieJar, LoadError, - Cookie, MISSING_FILENAME_TEXT, join_header_words, split_header_words, - iso2time, time2isoz) +from cookielib import (_warn_unhandled_exception, FileCookieJar, LoadError, + Cookie, MISSING_FILENAME_TEXT, + join_header_words, split_header_words, + iso2time, time2isoz) def lwp_cookie_str(cookie): """Return string representation of Cookie in an the LWP cookie file format. @@ -92,7 +93,8 @@ class LWPCookieJar(FileCookieJar): def _really_load(self, f, filename, ignore_discard, ignore_expires): magic = f.readline() if not re.search(self.magic_re, magic): - msg = "%s does not seem to contain cookies" % filename + msg = ("%r does not look like a Set-Cookie3 (LWP) format " + "file" % filename) raise LoadError(msg) now = time.time() @@ -159,6 +161,10 @@ class LWPCookieJar(FileCookieJar): if not ignore_expires and c.is_expired(now): continue self.set_cookie(c) - except: - reraise_unmasked_exceptions((IOError,)) - raise LoadError("invalid Set-Cookie3 format file %s" % filename) + + except IOError: + raise + except Exception: + _warn_unhandled_exception() + raise LoadError("invalid Set-Cookie3 format file %r: %r" % + (filename, line)) |