diff options
author | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2007-09-27 05:34:45 (GMT) |
---|---|---|
committer | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2007-09-27 05:34:45 (GMT) |
commit | 4df367c08d042f2bc6b789d197c86cf4c13a15df (patch) | |
tree | c219139703ffede4a1c946c8a0778997cd62cb22 /Lib | |
parent | 99479ebf9eb186c15ac4cac836a02b455e7f98a4 (diff) | |
download | cpython-4df367c08d042f2bc6b789d197c86cf4c13a15df.zip cpython-4df367c08d042f2bc6b789d197c86cf4c13a15df.tar.gz cpython-4df367c08d042f2bc6b789d197c86cf4c13a15df.tar.bz2 |
Change to flush and close logic to fix #1760556.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/logging/__init__.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py index 4bb8cf4..c7058d8 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): """ |