QueueHandler.prepare() now makes a copy of the record before modifying and enqueueing it, to avoid affecting other handlers in the chain.
(cherry picked from commit
da6424e96ada72c15c91bddb0a411acf7119e10a)
Co-authored-by: Manjusaka <lizheao940510@gmail.com>
from stat import ST_DEV, ST_INO, ST_MTIME
import queue
import threading
+import copy
#
# Some constants...
# 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
--- /dev/null
+QueueHandler.prepare() now makes a copy of the record before modifying and enqueueing it, to avoid affecting other handlers in the chain.