Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ae40c2f

Browse files
committed
[Patch #969907] Add traceback to warning output
1 parent 300ce19 commit ae40c2f

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

Lib/cookielib.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,11 @@ def reraise_unmasked_exceptions(unmasked=()):
4949
if issubclass(etype, unmasked):
5050
raise
5151
# swallowed an exception
52-
import warnings
53-
warnings.warn("cookielib bug!", stacklevel=2)
54-
import traceback
55-
traceback.print_exc()
52+
import warnings, traceback, StringIO
53+
f = StringIO.StringIO()
54+
traceback.print_exc(None, f)
55+
msg = f.getvalue()
56+
warnings.warn("cookielib bug!\n%s" % msg, stacklevel=2)
5657

5758

5859
# Date/time conversion

0 commit comments

Comments
 (0)