mirror of https://github.com/python/cpython.git
(Merge 3.2) logging: don't define QueueListener if Python has no thread support
This commit is contained in:
commit
59bec36b1c
|
@ -27,7 +27,10 @@
|
||||||
import logging, socket, os, pickle, struct, time, re
|
import logging, socket, os, pickle, struct, time, re
|
||||||
from stat import ST_DEV, ST_INO, ST_MTIME
|
from stat import ST_DEV, ST_INO, ST_MTIME
|
||||||
import queue
|
import queue
|
||||||
|
try:
|
||||||
import threading
|
import threading
|
||||||
|
except ImportError:
|
||||||
|
threading = None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import codecs
|
import codecs
|
||||||
|
@ -1218,6 +1221,7 @@ def emit(self, record):
|
||||||
except:
|
except:
|
||||||
self.handleError(record)
|
self.handleError(record)
|
||||||
|
|
||||||
|
if threading:
|
||||||
class QueueListener(object):
|
class QueueListener(object):
|
||||||
"""
|
"""
|
||||||
This class implements an internal threaded listener which watches for
|
This class implements an internal threaded listener which watches for
|
||||||
|
|
|
@ -2634,6 +2634,8 @@ def test_queue_handler(self):
|
||||||
self.assertEqual(data.name, self.que_logger.name)
|
self.assertEqual(data.name, self.que_logger.name)
|
||||||
self.assertEqual((data.msg, data.args), (msg, None))
|
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):
|
def test_queue_listener(self):
|
||||||
handler = TestHandler(Matcher())
|
handler = TestHandler(Matcher())
|
||||||
listener = logging.handlers.QueueListener(self.queue, handler)
|
listener = logging.handlers.QueueListener(self.queue, handler)
|
||||||
|
|
|
@ -132,6 +132,8 @@ Core and Builtins
|
||||||
Library
|
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
|
- 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.
|
around a mmap bug with sparse files. Patch written by Steffen Daode Nurpmeso.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue