[Python-checkins] cpython (merge default -> default): merge
brett.cannon
python-checkins at python.org
Fri Feb 24 00:30:18 CET 2012
http://hg.python.org/cpython/rev/548a023c8230
changeset: 75230:548a023c8230
parent: 75229:8d1040fdac60
parent: 75227:50b1f2d07011
user: Brett Cannon <brett at python.org>
date: Thu Feb 23 18:30:04 2012 -0500
summary:
merge
files:
.hgtags | 1 +
Doc/library/subprocess.rst | 2 +-
Doc/library/sys.rst | 5 +-
Doc/library/time.rst | 5 +-
Lib/logging/__init__.py | 28 ++++++++----
Lib/logging/handlers.py | 53 +++++++++++++++++--------
6 files changed, 62 insertions(+), 32 deletions(-)
diff --git a/.hgtags b/.hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -77,6 +77,7 @@
a4f75773c0060cee38b0bb651a7aba6f56b0e996 v3.1.3
32fcb9e94985cb19ce37ba9543f091c0dbe9d7dd v3.1.4rc1
c918ec9f3a76d6afedfbb5d455004de880443a3d v3.1.4
+ee26aca3219cf4bb0b93352e83edcc9cb28c7802 v3.1.5rc1
b37b7834757492d009b99cf0ca4d42d2153d7fac v3.2a1
56d4373cecb73c8b45126ba7b045b3c7b3f94b0b v3.2a2
da012d9a2c23d144e399d2e01a55b8a83ad94573 v3.2a3
diff --git a/Doc/library/subprocess.rst b/Doc/library/subprocess.rst
--- a/Doc/library/subprocess.rst
+++ b/Doc/library/subprocess.rst
@@ -240,7 +240,7 @@
When *stdout* or *stderr* are pipes and *universal_newlines* is
:const:`True` then the output data is assumed to be encoded as UTF-8 and
will automatically be decoded to text. All line endings will be converted
- to ``'\n'`` as described for the universal newlines `'U'`` mode argument
+ to ``'\n'`` as described for the universal newlines ``'U'`` mode argument
to :func:`open`.
If *shell* is :const:`True`, the specified command will be executed through
diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst
--- a/Doc/library/sys.rst
+++ b/Doc/library/sys.rst
@@ -195,7 +195,7 @@
be set at build time with the ``--exec-prefix`` argument to the
:program:`configure` script. Specifically, all configuration files (e.g. the
:file:`pyconfig.h` header file) are installed in the directory
- :file:`{exec_prefix}/lib/python{X.Y}/config', and shared library modules are
+ :file:`{exec_prefix}/lib/python{X.Y}/config`, and shared library modules are
installed in :file:`{exec_prefix}/lib/python{X.Y}/lib-dynload`, where *X.Y*
is the version number of Python, for example ``3.2``.
@@ -756,6 +756,7 @@
always use the ``startswith`` idiom presented above.
.. seealso::
+
:attr:`os.name` has a coarser granularity. :func:`os.uname` gives
system-dependent version information.
@@ -771,7 +772,7 @@
argument to the :program:`configure` script. The main collection of Python
library modules is installed in the directory :file:`{prefix}/lib/python{X.Y}``
while the platform independent header files (all except :file:`pyconfig.h`) are
- stored in :file:`{prefix}/include/python{X.Y}``, where *X.Y* is the version
+ stored in :file:`{prefix}/include/python{X.Y}`, where *X.Y* is the version
number of Python, for example ``3.2``.
diff --git a/Doc/library/time.rst b/Doc/library/time.rst
--- a/Doc/library/time.rst
+++ b/Doc/library/time.rst
@@ -228,8 +228,9 @@
.. function:: monotonic()
- Monotonic clock. The reference point of the returned value is undefined so
- only the difference of consecutive calls is valid.
+ Monotonic non-decreasing clock. The clock is not related to the system clock
+ and cannot go backward. The reference point of the returned
+ value is undefined so only the difference of consecutive calls is valid.
.. versionadded:: 3.3
diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py
--- a/Lib/logging/__init__.py
+++ b/Lib/logging/__init__.py
@@ -16,9 +16,9 @@
"""
Logging package for Python. Based on PEP 282 and comments thereto in
-comp.lang.python, and influenced by Apache's log4j system.
+comp.lang.python.
-Copyright (C) 2001-2011 Vinay Sajip. All Rights Reserved.
+Copyright (C) 2001-2012 Vinay Sajip. All Rights Reserved.
To use, simply 'import logging' and log away!
"""
@@ -914,8 +914,12 @@
"""
Flushes the stream.
"""
- if self.stream and hasattr(self.stream, "flush"):
- self.stream.flush()
+ self.acquire()
+ try:
+ if self.stream and hasattr(self.stream, "flush"):
+ self.stream.flush()
+ finally:
+ self.release()
def emit(self, record):
"""
@@ -964,12 +968,16 @@
"""
Closes the stream.
"""
- if self.stream:
- self.flush()
- if hasattr(self.stream, "close"):
- self.stream.close()
- StreamHandler.close(self)
- self.stream = None
+ self.acquire()
+ try:
+ if self.stream:
+ self.flush()
+ if hasattr(self.stream, "close"):
+ self.stream.close()
+ StreamHandler.close(self)
+ self.stream = None
+ finally:
+ self.release()
def _open(self):
"""
diff --git a/Lib/logging/handlers.py b/Lib/logging/handlers.py
--- a/Lib/logging/handlers.py
+++ b/Lib/logging/handlers.py
@@ -1,4 +1,4 @@
-# Copyright 2001-2010 by Vinay Sajip. All Rights Reserved.
+# Copyright 2001-2012 by Vinay Sajip. All Rights Reserved.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted,
@@ -16,10 +16,9 @@
"""
Additional handlers for the logging package for Python. The core package is
-based on PEP 282 and comments thereto in comp.lang.python, and influenced by
-Apache's log4j system.
+based on PEP 282 and comments thereto in comp.lang.python.
-Copyright (C) 2001-2010 Vinay Sajip. All Rights Reserved.
+Copyright (C) 2001-2012 Vinay Sajip. All Rights Reserved.
To use, simply 'import logging.handlers' and log away!
"""
@@ -594,10 +593,14 @@
"""
Closes the socket.
"""
- if self.sock:
- self.sock.close()
- self.sock = None
- logging.Handler.close(self)
+ self.acquire()
+ try:
+ if self.sock:
+ self.sock.close()
+ self.sock = None
+ logging.Handler.close(self)
+ finally:
+ self.release()
class DatagramHandler(SocketHandler):
"""
@@ -792,8 +795,12 @@
"""
Closes the socket.
"""
- self.socket.close()
- logging.Handler.close(self)
+ self.acquire()
+ try:
+ self.socket.close()
+ logging.Handler.close(self)
+ finally:
+ self.release()
def mapPriority(self, levelName):
"""
@@ -1137,7 +1144,11 @@
This version just zaps the buffer to empty.
"""
- self.buffer = []
+ self.acquire()
+ try:
+ self.buffer = []
+ finally:
+ self.release()
def close(self):
"""
@@ -1187,18 +1198,26 @@
The record buffer is also cleared by this operation.
"""
- if self.target:
- for record in self.buffer:
- self.target.handle(record)
- self.buffer = []
+ self.acquire()
+ try:
+ if self.target:
+ for record in self.buffer:
+ self.target.handle(record)
+ self.buffer = []
+ finally:
+ self.release()
def close(self):
"""
Flush, set the target to None and lose the buffer.
"""
self.flush()
- self.target = None
- BufferingHandler.close(self)
+ self.acquire()
+ try:
+ self.target = None
+ BufferingHandler.close(self)
+ finally:
+ self.release()
class QueueHandler(logging.Handler):
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list