Skip to content

Commit 8d19977

Browse files
[3.12] gh-119819: Update logging configuration to support joinable multiproc… (GH-120090) (GH-120092)
(cherry picked from commit 983efcf)
1 parent c46621b commit 8d19977

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

Lib/logging/config.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -790,8 +790,10 @@ def configure_handler(self, config):
790790
from multiprocessing.queues import Queue as MPQueue
791791
from multiprocessing import Manager as MM
792792
proxy_queue = MM().Queue()
793+
proxy_joinable_queue = MM().JoinableQueue()
793794
qspec = config['queue']
794-
if not isinstance(qspec, (queue.Queue, MPQueue, type(proxy_queue))):
795+
if not isinstance(qspec, (queue.Queue, MPQueue,
796+
type(proxy_queue), type(proxy_joinable_queue))):
795797
if isinstance(qspec, str):
796798
q = self.resolve(qspec)
797799
if not callable(q):

Lib/test/test_logging.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3896,12 +3896,16 @@ def test_config_queue_handler(self):
38963896

38973897
def test_multiprocessing_queues(self):
38983898
# See gh-119819
3899-
import_helper.import_module('_multiprocessing') # will skip test if it's not available
3899+
3900+
# will skip test if it's not available
3901+
import_helper.import_module('_multiprocessing')
3902+
39003903
cd = copy.deepcopy(self.config_queue_handler)
39013904
from multiprocessing import Queue as MQ, Manager as MM
39023905
q1 = MQ() # this can't be pickled
39033906
q2 = MM().Queue() # a proxy queue for use when pickling is needed
3904-
for qspec in (q1, q2):
3907+
q3 = MM().JoinableQueue() # a joinable proxy queue
3908+
for qspec in (q1, q2, q3):
39053909
fn = make_temp_file('.log', 'test_logging-cmpqh-')
39063910
cd['handlers']['h1']['filename'] = fn
39073911
cd['handlers']['ah']['queue'] = qspec

0 commit comments

Comments
 (0)