From: Vinay Sajip Date: Thu, 27 Sep 2007 05:34:45 +0000 (+0000) Subject: Change to flush and close logic to fix #1760556. X-Git-Tag: v2.6a1~1248 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4df367c08d042f2bc6b789d197c86cf4c13a15df;p=thirdparty%2FPython%2Fcpython.git Change to flush and close logic to fix #1760556. --- diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py index 4bb8cf446fdb..c7058d803a8b 100644 --- a/Lib/logging/__init__.py +++ b/Lib/logging/__init__.py @@ -728,7 +728,8 @@ class StreamHandler(Handler): """ Flushes the stream. """ - self.stream.flush() + if self.stream: + self.stream.flush() def emit(self, record): """ @@ -778,9 +779,11 @@ class FileHandler(StreamHandler): """ Closes the stream. """ - self.flush() - self.stream.close() - StreamHandler.close(self) + if self.stream: + self.flush() + self.stream.close() + StreamHandler.close(self) + self.stream = None def _open(self): """