summaryrefslogtreecommitdiffstats
path: root/Lib/logging/handlers.py
diff options
context:
space:
mode:
authorManjusaka <lizheao940510@gmail.com>2019-01-23 07:08:38 (GMT)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>2019-01-23 07:08:38 (GMT)
commitda6424e96ada72c15c91bddb0a411acf7119e10a (patch)
tree6df2b6b98cea072572a2adc3726345e2f0f23445 /Lib/logging/handlers.py
parent6d43f6f081023b680d9db4542d19b9e382149f0a (diff)
downloadcpython-da6424e96ada72c15c91bddb0a411acf7119e10a.zip
cpython-da6424e96ada72c15c91bddb0a411acf7119e10a.tar.gz
cpython-da6424e96ada72c15c91bddb0a411acf7119e10a.tar.bz2
bpo-35726: Prevented QueueHandler formatting from affecting other handlers (GH-11537)
QueueHandler.prepare() now makes a copy of the record before modifying and enqueueing it, to avoid affecting other handlers in the chain.
Diffstat (limited to 'Lib/logging/handlers.py')
-rw-r--r--Lib/logging/handlers.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/logging/handlers.py b/Lib/logging/handlers.py
index e213e43..3727bf0 100644
--- a/Lib/logging/handlers.py
+++ b/Lib/logging/handlers.py
@@ -27,6 +27,7 @@ import logging, socket, os, pickle, struct, time, re
from stat import ST_DEV, ST_INO, ST_MTIME
import queue
import threading
+import copy
#
# Some constants...
@@ -1377,6 +1378,8 @@ class QueueHandler(logging.Handler):
# exc_info and exc_text attributes, as they are no longer
# needed and, if not None, will typically not be pickleable.
msg = self.format(record)
+ # bpo-35726: make copy of record to avoid affecting other handlers in the chain.
+ record = copy.copy(record)
record.message = msg
record.msg = msg
record.args = None