]> granicus.if.org Git - python/commitdiff
Issue #8581: logging: removed errors raised when closing handlers twice.
authorVinay Sajip <vinay_sajip@yahoo.co.uk>
Mon, 3 May 2010 15:39:57 +0000 (15:39 +0000)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>
Mon, 3 May 2010 15:39:57 +0000 (15:39 +0000)
Lib/logging/__init__.py
Misc/NEWS

index 6791259f8e6bba9cce5028def5aa74bccb334b12..ba40067b6132cda06e9e5d279c54326bf3691d6f 100644 (file)
@@ -702,8 +702,10 @@ class Handler(Filterer):
         #get the module data lock, as we're updating a shared structure.
         _acquireLock()
         try:    #unlikely to raise an exception, but you never know...
-            del _handlers[self]
-            _handlerList.remove(self)
+            if self in _handlers:
+                del _handlers[self]
+            if self in _handlerList:
+                _handlerList.remove(self)
         finally:
             _releaseLock()
 
index f943618c69b4c087cceda04382f5ef5703cbdb7b..62d4e59a7bfd85844897a6404550c14d25854f4d 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -33,6 +33,8 @@ Core and Builtins
 Library
 -------
 
+- Issue #8581: logging: removed errors raised when closing handlers twice.
+
 - Issue #4687: Fix accuracy of garbage collection runtimes displayed with
   gc.DEBUG_STATS.