Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
09a98a99
Commit
09a98a99
authored
May 02, 2011
by
Alexander Belopolsky
Browse files
Options
Browse Files
Download
Plain Diff
merge
parents
03163ac1
72c53b5d
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
130 additions
and
127 deletions
+130
-127
Lib/logging/handlers.py
Lib/logging/handlers.py
+116
-112
Lib/test/test_logging.py
Lib/test/test_logging.py
+6
-1
Misc/NEWS
Misc/NEWS
+2
-0
Modules/signalmodule.c
Modules/signalmodule.c
+6
-14
No files found.
Lib/logging/handlers.py
View file @
09a98a99
...
@@ -27,7 +27,10 @@ To use, simply 'import logging.handlers' and log away!
...
@@ -27,7 +27,10 @@ To use, simply 'import logging.handlers' and log away!
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
import
threading
try
:
import
threading
except
ImportError
:
threading
=
None
try
:
try
:
import
codecs
import
codecs
...
@@ -1218,7 +1221,8 @@ class QueueHandler(logging.Handler):
...
@@ -1218,7 +1221,8 @@ class QueueHandler(logging.Handler):
except
:
except
:
self
.
handleError
(
record
)
self
.
handleError
(
record
)
class
QueueListener
(
object
):
if
threading
:
class
QueueListener
(
object
):
"""
"""
This class implements an internal threaded listener which watches for
This class implements an internal threaded listener which watches for
LogRecords being added to a queue, removes them and passes them to a
LogRecords being added to a queue, removes them and passes them to a
...
...
Lib/test/test_logging.py
View file @
09a98a99
...
@@ -1385,7 +1385,10 @@ class DatagramHandlerTest(BaseTest):
...
@@ -1385,7 +1385,10 @@ class DatagramHandlerTest(BaseTest):
logger = logging.getLogger("
udp
")
logger = logging.getLogger("
udp
")
logger.error("
spam
")
logger.error("
spam
")
self.handled.wait()
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.')
@unittest.skipUnless(threading, 'Threading required for this test.')
...
@@ -2631,6 +2634,8 @@ class QueueHandlerTest(BaseTest):
...
@@ -2631,6 +2634,8 @@ class QueueHandlerTest(BaseTest):
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)
...
...
Misc/NEWS
View file @
09a98a99
...
@@ -132,6 +132,8 @@ Core and Builtins
...
@@ -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
.
...
...
Modules/signalmodule.c
View file @
09a98a99
...
@@ -720,24 +720,16 @@ PyInit_signal(void)
...
@@ -720,24 +720,16 @@ PyInit_signal(void)
Py_DECREF
(
x
);
Py_DECREF
(
x
);
#ifdef SIG_BLOCK
#ifdef SIG_BLOCK
x
=
PyLong_FromLong
(
SIG_BLOCK
);
if
(
PyModule_AddIntMacro
(
m
,
SIG_BLOCK
))
if
(
!
x
||
PyDict_SetItemString
(
d
,
"SIG_BLOCK"
,
x
)
<
0
)
goto
finally
;
goto
finally
;
Py_DECREF
(
x
);
#endif
#endif
#ifdef SIG_UNBLOCK
#ifdef SIG_UNBLOCK
x
=
PyLong_FromLong
(
SIG_UNBLOCK
);
if
(
PyModule_AddIntMacro
(
m
,
SIG_UNBLOCK
))
if
(
!
x
||
PyDict_SetItemString
(
d
,
"SIG_UNBLOCK"
,
x
)
<
0
)
goto
finally
;
goto
finally
;
Py_DECREF
(
x
);
#endif
#endif
#ifdef SIG_SETMASK
#ifdef SIG_SETMASK
x
=
PyLong_FromLong
(
SIG_SETMASK
);
if
(
PyModule_AddIntMacro
(
m
,
SIG_SETMASK
))
if
(
!
x
||
PyDict_SetItemString
(
d
,
"SIG_SETMASK"
,
x
)
<
0
)
goto
finally
;
goto
finally
;
Py_DECREF
(
x
);
#endif
#endif
x
=
IntHandler
=
PyDict_GetItemString
(
d
,
"default_int_handler"
);
x
=
IntHandler
=
PyDict_GetItemString
(
d
,
"default_int_handler"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment