mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Closes #14436: Convert msg + args to string before pickling.
This commit is contained in:
parent
c37db10e03
commit
7ce9bda575
1 changed files with 9 additions and 2 deletions
|
@ -528,9 +528,16 @@ class SocketHandler(logging.Handler):
|
||||||
"""
|
"""
|
||||||
ei = record.exc_info
|
ei = record.exc_info
|
||||||
if ei:
|
if ei:
|
||||||
dummy = self.format(record) # just to get traceback text into record.exc_text
|
# just to get traceback text into record.exc_text ...
|
||||||
|
dummy = self.format(record)
|
||||||
record.exc_info = None # to avoid Unpickleable error
|
record.exc_info = None # to avoid Unpickleable error
|
||||||
s = cPickle.dumps(record.__dict__, 1)
|
# 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
|
||||||
|
s = cPickle.dumps(d, 1)
|
||||||
if ei:
|
if ei:
|
||||||
record.exc_info = ei # for next handler
|
record.exc_info = ei # for next handler
|
||||||
slen = struct.pack(">L", len(s))
|
slen = struct.pack(">L", len(s))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue