Commit 59bec36b authored by Victor Stinner's avatar Victor Stinner

(Merge 3.2) logging: don't define QueueListener if Python has no thread support

parents 714b8dc5 cafa2efe
......@@ -27,7 +27,10 @@ To use, simply 'import logging.handlers' and log away!
import logging, socket, os, pickle, struct, time, re
from stat import ST_DEV, ST_INO, ST_MTIME
import queue
import threading
try:
import threading
except ImportError:
threading = None
try:
import codecs
......@@ -1218,7 +1221,8 @@ class QueueHandler(logging.Handler):
except:
self.handleError(record)
class QueueListener(object):
if threading:
class QueueListener(object):
"""
This class implements an internal threaded listener which watches for
LogRecords being added to a queue, removes them and passes them to a
......
......@@ -2634,6 +2634,8 @@ class QueueHandlerTest(BaseTest):
self.assertEqual(data.name, self.que_logger.name)
self.assertEqual((data.msg, data.args), (msg, None))
@unittest.skipUnless(hasattr(logging.handlers, 'QueueListener'),
'logging.handlers.QueueListener required for this test')
def test_queue_listener(self):
handler = TestHandler(Matcher())
listener = logging.handlers.QueueListener(self.queue, handler)
......
......@@ -132,6 +132,8 @@ Core and Builtins
Library
-------
- logging: don't define QueueListener if Python has no thread support.
- Issue #11277: mmap.mmap() calls fcntl(fd, F_FULLFSYNC) on Mac OS X to get
around a mmap bug with sparse files. Patch written by Steffen Daode Nurpmeso.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment