From be17479974cf0316111fb85225cfbdb266facafe Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Mon, 8 May 2006 17:48:01 +0000 Subject: Patch #1478993: take advantage of BaseException/Exception split in cookielib --- Lib/_LWPCookieJar.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'Lib/_LWPCookieJar.py') diff --git a/Lib/_LWPCookieJar.py b/Lib/_LWPCookieJar.py index 6d5ce185e5..76da942a53 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)) -- cgit v1.2.1