https://github.com/python/cpython/commit/983efcf15b2503fe0c05d5e03762385967962b33
commit: 983efcf15b2503fe0c05d5e03762385967962b33
branch: main
author: Vinay Sajip <[email protected]>
committer: vsajip <[email protected]>
date: 2024-06-05T07:25:47+01:00
summary:

gh-119819: Update logging configuration to support joinable multiproc… 
(GH-120090)

gh-119819: Update logging configuration to support joinable multiprocessing 
manager queues.

files:
M Lib/logging/config.py
M Lib/test/test_logging.py

diff --git a/Lib/logging/config.py b/Lib/logging/config.py
index 0b10bf82b60a36..9de84e527b18ac 100644
--- a/Lib/logging/config.py
+++ b/Lib/logging/config.py
@@ -783,8 +783,10 @@ def configure_handler(self, config):
                     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 0c9a24e58dfd8c..ef2d4a621be962 100644
--- a/Lib/test/test_logging.py
+++ b/Lib/test/test_logging.py
@@ -3928,12 +3928,16 @@ def test_config_queue_handler(self):
 
     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

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to