Index: Lib/logging/__init__.py =================================================================== --- Lib/logging/__init__.py (revision 80667) +++ Lib/logging/__init__.py (working copy) @@ -701,9 +701,11 @@ """ #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) + try: + if self in _handlers: + del _handlers[self] + if self in _handlerList: + _handlerList.remove(self) finally: _releaseLock()