mirror of
https://github.com/python/cpython.git
synced 2025-09-29 03:35:31 +00:00
merge
This commit is contained in:
commit
09a98a99cd
4 changed files with 116 additions and 113 deletions
|
@ -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
|
||||
try:
|
||||
import threading
|
||||
except ImportError:
|
||||
threading = None
|
||||
|
||||
try:
|
||||
import codecs
|
||||
|
@ -1218,6 +1221,7 @@ class QueueHandler(logging.Handler):
|
|||
except:
|
||||
self.handleError(record)
|
||||
|
||||
if threading:
|
||||
class QueueListener(object):
|
||||
"""
|
||||
This class implements an internal threaded listener which watches for
|
||||
|
|
|
@ -1385,7 +1385,10 @@ class DatagramHandlerTest(BaseTest):
|
|||
logger = logging.getLogger("udp")
|
||||
logger.error("spam")
|
||||
self.handled.wait()
|
||||
self.assertEqual(self.log_output, "spam\n")
|
||||
self.handled.clear()
|
||||
logger.error("eggs")
|
||||
self.handled.wait()
|
||||
self.assertEqual(self.log_output, "spam\neggs\n")
|
||||
|
||||
|
||||
@unittest.skipUnless(threading, 'Threading required for this test.')
|
||||
|
@ -2631,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.
|
||||
|
||||
|
|
|
@ -720,24 +720,16 @@ PyInit_signal(void)
|
|||
Py_DECREF(x);
|
||||
|
||||
#ifdef SIG_BLOCK
|
||||
x = PyLong_FromLong(SIG_BLOCK);
|
||||
if (!x || PyDict_SetItemString(d, "SIG_BLOCK", x) < 0)
|
||||
if (PyModule_AddIntMacro(m, SIG_BLOCK))
|
||||
goto finally;
|
||||
Py_DECREF(x);
|
||||
#endif
|
||||
|
||||
#ifdef SIG_UNBLOCK
|
||||
x = PyLong_FromLong(SIG_UNBLOCK);
|
||||
if (!x || PyDict_SetItemString(d, "SIG_UNBLOCK", x) < 0)
|
||||
if (PyModule_AddIntMacro(m, SIG_UNBLOCK))
|
||||
goto finally;
|
||||
Py_DECREF(x);
|
||||
#endif
|
||||
|
||||
#ifdef SIG_SETMASK
|
||||
x = PyLong_FromLong(SIG_SETMASK);
|
||||
if (!x || PyDict_SetItemString(d, "SIG_SETMASK", x) < 0)
|
||||
if (PyModule_AddIntMacro(m, SIG_SETMASK))
|
||||
goto finally;
|
||||
Py_DECREF(x);
|
||||
#endif
|
||||
|
||||
x = IntHandler = PyDict_GetItemString(d, "default_int_handler");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue