summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2024-06-05 06:59:15 (GMT)
committerGitHub <noreply@github.com>2024-06-05 06:59:15 (GMT)
commit8d199774cb6b68b295b78cb8be9a3afc805ac880 (patch)
tree74741772c6ca91276539880af5e690eff5a324ce
parentc46621bf33f037c7f6d3fd8299bef02d4e186b70 (diff)
downloadcpython-8d199774cb6b68b295b78cb8be9a3afc805ac880.zip
cpython-8d199774cb6b68b295b78cb8be9a3afc805ac880.tar.gz
cpython-8d199774cb6b68b295b78cb8be9a3afc805ac880.tar.bz2
[3.12] gh-119819: Update logging configuration to support joinable multiproc… (GH-120090) (GH-120092)
(cherry picked from commit 983efcf15b2503fe0c05d5e03762385967962b33)
-rw-r--r--Lib/logging/config.py4
-rw-r--r--Lib/test/test_logging.py8
2 files changed, 9 insertions, 3 deletions
diff --git a/Lib/logging/config.py b/Lib/logging/config.py
index c98eb6c..1824d0a 100644
--- a/Lib/logging/config.py
+++ b/Lib/logging/config.py
@@ -790,8 +790,10 @@ class DictConfigurator(BaseConfigurator):
from multiprocessing.queues import Queue as MPQueue
from multiprocessing import Manager as MM
proxy_queue = MM().Queue()
+ proxy_joinable_queue = MM().JoinableQueue()
qspec = config['queue']
- if not isinstance(qspec, (queue.Queue, MPQueue, type(proxy_queue))):
+ if not isinstance(qspec, (queue.Queue, MPQueue,
+ type(proxy_queue), type(proxy_joinable_queue))):
if isinstance(qspec, str):
q = self.resolve(qspec)
if not callable(q):
diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py
index 38caa56..6dd1b6f 100644
--- a/Lib/test/test_logging.py
+++ b/Lib/test/test_logging.py
@@ -3896,12 +3896,16 @@ class ConfigDictTest(BaseTest):
def test_multiprocessing_queues(self):
# See gh-119819
- import_helper.import_module('_multiprocessing') # will skip test if it's not available
+
+ # will skip test if it's not available
+ import_helper.import_module('_multiprocessing')
+
cd = copy.deepcopy(self.config_queue_handler)
from multiprocessing import Queue as MQ, Manager as MM
q1 = MQ() # this can't be pickled
q2 = MM().Queue() # a proxy queue for use when pickling is needed
- for qspec in (q1, q2):
+ q3 = MM().JoinableQueue() # a joinable proxy queue
+ for qspec in (q1, q2, q3):
fn = make_temp_file('.log', 'test_logging-cmpqh-')
cd['handlers']['h1']['filename'] = fn
cd['handlers']['ah']['queue'] = qspec