Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit da6424e

Browse filesBrowse files
Zheaolivsajip
authored andcommitted
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.
1 parent 6d43f6f commit da6424e
Copy full SHA for da6424e

File tree

Expand file treeCollapse file tree

2 files changed

+4
-0
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+4
-0
lines changed

‎Lib/logging/handlers.py

Copy file name to clipboardExpand all lines: Lib/logging/handlers.py
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
from stat import ST_DEV, ST_INO, ST_MTIME
2828
import queue
2929
import threading
30+
import copy
3031

3132
#
3233
# Some constants...
@@ -1377,6 +1378,8 @@ def prepare(self, record):
13771378
# exc_info and exc_text attributes, as they are no longer
13781379
# needed and, if not None, will typically not be pickleable.
13791380
msg = self.format(record)
1381+
# bpo-35726: make copy of record to avoid affecting other handlers in the chain.
1382+
record = copy.copy(record)
13801383
record.message = msg
13811384
record.msg = msg
13821385
record.args = None
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
QueueHandler.prepare() now makes a copy of the record before modifying and enqueueing it, to avoid affecting other handlers in the chain.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.