Merged fix added for recent changes in non-threading environments.

This commit is contained in:
Vinay Sajip 2012-02-23 20:51:18 +00:00
commit 323e4fb864
2 changed files with 28 additions and 7 deletions

View file

@ -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):
"""