[New-bugs-announce] [issue8581] Logging handlers do not handle double-closing very well

Jason Baker report at bugs.python.org
Fri Apr 30 22:34:32 CEST 2010


New submission from Jason Baker <amnorvend at gmail.com>:

The logging handler does not handle double-closing very well:

>>> from logging import StreamHandler
>>> h = StreamHandler()
>>> h.close()
>>> h.close()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.6/logging/__init__.py", line 705, in close
    del _handlers[self]
KeyError: <logging.StreamHandler instance at 0xb7609c8c>

There are two possible approaches to this:

 1. Raise a better error.
 2. Ignore the duplicate close.

This patch takes option 2 as this is likely not indicative of any kind of programmer error, but it shouldn't be too difficult to take option 1 instead.

----------
components: Library (Lib)
messages: 104662
nosy: Jason.Baker
priority: normal
severity: normal
status: open
title: Logging handlers do not handle double-closing very well
type: behavior
versions: Python 2.6, Python 3.1

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue8581>
_______________________________________


More information about the New-bugs-announce mailing list