Kaydet (Commit) da6424e9 authored tarafından Manjusaka's avatar Manjusaka Kaydeden (comit) Vinay Sajip

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.
üst 6d43f6f0
...@@ -27,6 +27,7 @@ import logging, socket, os, pickle, struct, time, re ...@@ -27,6 +27,7 @@ import logging, socket, os, pickle, struct, time, re
from stat import ST_DEV, ST_INO, ST_MTIME from stat import ST_DEV, ST_INO, ST_MTIME
import queue import queue
import threading import threading
import copy
# #
# Some constants... # Some constants...
...@@ -1377,6 +1378,8 @@ class QueueHandler(logging.Handler): ...@@ -1377,6 +1378,8 @@ class QueueHandler(logging.Handler):
# exc_info and exc_text attributes, as they are no longer # exc_info and exc_text attributes, as they are no longer
# needed and, if not None, will typically not be pickleable. # needed and, if not None, will typically not be pickleable.
msg = self.format(record) 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.message = msg
record.msg = msg record.msg = msg
record.args = None record.args = None
......
QueueHandler.prepare() now makes a copy of the record before modifying and enqueueing it, to avoid affecting other handlers in the chain.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment