summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVinay Sajip <vinay_sajip@yahoo.co.uk>2010-05-03 15:39:57 (GMT)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>2010-05-03 15:39:57 (GMT)
commitc7cbb9b509ae9b1d3b98d0ee58afa3ef1fdd61ac (patch)
tree5f4f70fef0ca8f8cd13a894e145022b450d7e7cf
parent350c394c87b1bf19f6aeaf5e5fb63e446b9fd78d (diff)
downloadcpython-c7cbb9b509ae9b1d3b98d0ee58afa3ef1fdd61ac.zip
cpython-c7cbb9b509ae9b1d3b98d0ee58afa3ef1fdd61ac.tar.gz
cpython-c7cbb9b509ae9b1d3b98d0ee58afa3ef1fdd61ac.tar.bz2
Issue #8581: logging: removed errors raised when closing handlers twice.
-rw-r--r--Lib/logging/__init__.py6
-rw-r--r--Misc/NEWS2
2 files changed, 6 insertions, 2 deletions
diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py
index 6791259..ba40067 100644
--- a/Lib/logging/__init__.py
+++ b/Lib/logging/__init__.py
@@ -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()
diff --git a/Misc/NEWS b/Misc/NEWS
index f943618..62d4e59 100644
--- 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.