summaryrefslogtreecommitdiffstats
path: root/Lib/logging
diff options
context:
space:
mode:
authorBénédikt Tran <10796600+picnixz@users.noreply.github.com>2024-10-07 18:42:19 (GMT)
committerGitHub <noreply@github.com>2024-10-07 18:42:19 (GMT)
commit7ffe94fb242fd51bb07c7f0d31e94efeea3619d4 (patch)
treebb549321720006985d642a1ade84a3180fdc542f /Lib/logging
parent03775472cc69e150ced22dc30334a7a202fc0380 (diff)
downloadcpython-7ffe94fb242fd51bb07c7f0d31e94efeea3619d4.zip
cpython-7ffe94fb242fd51bb07c7f0d31e94efeea3619d4.tar.gz
cpython-7ffe94fb242fd51bb07c7f0d31e94efeea3619d4.tar.bz2
gh-124653: Relax (again) detection of queue API for logging handlers (GH-124897)
Diffstat (limited to 'Lib/logging')
-rw-r--r--Lib/logging/config.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/Lib/logging/config.py b/Lib/logging/config.py
index 3781cb1..6a6a7f7 100644
--- a/Lib/logging/config.py
+++ b/Lib/logging/config.py
@@ -499,7 +499,7 @@ class BaseConfigurator(object):
def _is_queue_like_object(obj):
"""Check that *obj* implements the Queue API."""
- if isinstance(obj, queue.Queue):
+ if isinstance(obj, (queue.Queue, queue.SimpleQueue)):
return True
# defer importing multiprocessing as much as possible
from multiprocessing.queues import Queue as MPQueue
@@ -516,13 +516,13 @@ def _is_queue_like_object(obj):
# Ideally, we would have wanted to simply use strict type checking
# instead of a protocol-based type checking since the latter does
# not check the method signatures.
- queue_interface = [
- 'empty', 'full', 'get', 'get_nowait',
- 'put', 'put_nowait', 'join', 'qsize',
- 'task_done',
- ]
+ #
+ # Note that only 'put_nowait' and 'get' are required by the logging
+ # queue handler and queue listener (see gh-124653) and that other
+ # methods are either optional or unused.
+ minimal_queue_interface = ['put_nowait', 'get']
return all(callable(getattr(obj, method, None))
- for method in queue_interface)
+ for method in minimal_queue_interface)
class DictConfigurator(BaseConfigurator):
"""