summaryrefslogtreecommitdiffstats
path: root/Lib/logging
diff options
context:
space:
mode:
authorVinay Sajip <vinay_sajip@yahoo.co.uk>2012-03-29 19:18:21 (GMT)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>2012-03-29 19:18:21 (GMT)
commitb4f6da826545d3f913316f89c0998988b33d4efa (patch)
tree1c0c74d6d1be704258701df53246638d485fad06 /Lib/logging
parentd3cebd790de921f8797744822cdaab5e3f02db9f (diff)
parent6f5e54e76915d9a8767f7241f0e835116877e6e5 (diff)
downloadcpython-b4f6da826545d3f913316f89c0998988b33d4efa.zip
cpython-b4f6da826545d3f913316f89c0998988b33d4efa.tar.gz
cpython-b4f6da826545d3f913316f89c0998988b33d4efa.tar.bz2
Closes #14436: merged fix from 3.2.
Diffstat (limited to 'Lib/logging')
-rw-r--r--Lib/logging/handlers.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/Lib/logging/handlers.py b/Lib/logging/handlers.py
index f8632ce..198625b 100644
--- a/Lib/logging/handlers.py
+++ b/Lib/logging/handlers.py
@@ -559,11 +559,16 @@ class SocketHandler(logging.Handler):
"""
ei = record.exc_info
if ei:
- dummy = self.format(record) # just to get traceback text into record.exc_text
- record.exc_info = None # to avoid Unpickleable error
- s = pickle.dumps(record.__dict__, 1)
- if ei:
- record.exc_info = ei # for next handler
+ # just to get traceback text into record.exc_text ...
+ dummy = self.format(record)
+ # See issue #14436: If msg or args are objects, they may not be
+ # available on the receiving end. So we convert the msg % args
+ # to a string, save it as msg and zap the args.
+ d = dict(record.__dict__)
+ d['msg'] = record.getMessage()
+ d['args'] = None
+ d['exc_info'] = None
+ s = pickle.dumps(d, 1)
slen = struct.pack(">L", len(s))
return slen + s