summaryrefslogtreecommitdiffstats
path: root/Lib/logging/__init__.py
diff options
context:
space:
mode:
authorVinay Sajip <vinay_sajip@yahoo.co.uk>2012-02-23 20:51:18 (GMT)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>2012-02-23 20:51:18 (GMT)
commit323e4fb864301654a798e273409b645d097d02a5 (patch)
tree18bda12823599e53882f7faaf2737512e95979f0 /Lib/logging/__init__.py
parent57c223791de6edb7fd302bd682630ab1e259a06b (diff)
parentf05090372a43966266a8d20b9c21d348e417a48e (diff)
downloadcpython-323e4fb864301654a798e273409b645d097d02a5.zip
cpython-323e4fb864301654a798e273409b645d097d02a5.tar.gz
cpython-323e4fb864301654a798e273409b645d097d02a5.tar.bz2
Merged 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 3bd423d..e79018f 100644
--- a/Lib/logging/__init__.py
+++ b/Lib/logging/__init__.py
@@ -914,9 +914,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):
"""
@@ -965,13 +968,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):
"""