summaryrefslogtreecommitdiffstats
path: root/Lib/logging/__init__.py
diff options
context:
space:
mode:
authorVinay Sajip <vinay_sajip@yahoo.co.uk>2012-02-23 20:49:08 (GMT)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>2012-02-23 20:49:08 (GMT)
commitf05090372a43966266a8d20b9c21d348e417a48e (patch)
treee9f9353df039a4f47e1c7de38a309f8d4c7f8c2d /Lib/logging/__init__.py
parent0abf61db4dd0d008ad06c84cd882fb84e5c11181 (diff)
downloadcpython-f05090372a43966266a8d20b9c21d348e417a48e.zip
cpython-f05090372a43966266a8d20b9c21d348e417a48e.tar.gz
cpython-f05090372a43966266a8d20b9c21d348e417a48e.tar.bz2
Fix added for recent changes in non-threading environments.
Diffstat (limited to 'Lib/logging/__init__.py')
-rw-r--r--Lib/logging/__init__.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py
index b4c823d..4191b22 100644
--- a/Lib/logging/__init__.py
+++ b/Lib/logging/__init__.py
@@ -917,9 +917,12 @@ class StreamHandler(Handler):
"""
Flushes the stream.
"""
- with self.lock:
+ self.acquire()
+ try:
if self.stream and hasattr(self.stream, "flush"):
self.stream.flush()
+ finally:
+ self.release()
def emit(self, record):
"""
@@ -970,13 +973,16 @@ class FileHandler(StreamHandler):
"""
Closes the stream.
"""
- with self.lock:
+ 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):
"""