From: Andrew M. Kuchling Date: Sat, 10 Jul 2004 18:32:12 +0000 (+0000) Subject: [Patch #969907] Add traceback to warning output X-Git-Tag: v2.4a2~335 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ae40c2f795c038abbc5e6df05f050f3d8154c4a7;p=python [Patch #969907] Add traceback to warning output --- diff --git a/Lib/cookielib.py b/Lib/cookielib.py index f2cc132976..a5e84e39f2 100644 --- a/Lib/cookielib.py +++ b/Lib/cookielib.py @@ -49,10 +49,11 @@ def reraise_unmasked_exceptions(unmasked=()): if issubclass(etype, unmasked): raise # swallowed an exception - import warnings - warnings.warn("cookielib bug!", stacklevel=2) - import traceback - traceback.print_exc() + import warnings, traceback, StringIO + f = StringIO.StringIO() + traceback.print_exc(None, f) + msg = f.getvalue() + warnings.warn("cookielib bug!\n%s" % msg, stacklevel=2) # Date/time conversion