[Python-checkins] r58268 - python/trunk/Lib/logging/__init__.py

vinay.sajip python-checkins at python.org
Thu Sep 27 07:34:45 CEST 2007


Author: vinay.sajip
Date: Thu Sep 27 07:34:45 2007
New Revision: 58268

Modified:
   python/trunk/Lib/logging/__init__.py
Log:
Change to flush and close logic to fix #1760556.

Modified: python/trunk/Lib/logging/__init__.py
==============================================================================
--- python/trunk/Lib/logging/__init__.py	(original)
+++ python/trunk/Lib/logging/__init__.py	Thu Sep 27 07:34:45 2007
@@ -728,7 +728,8 @@
         """
         Flushes the stream.
         """
-        self.stream.flush()
+        if self.stream:
+            self.stream.flush()
 
     def emit(self, record):
         """
@@ -778,9 +779,11 @@
         """
         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):
         """


More information about the Python-checkins mailing list