[New-bugs-announce] [issue9501] Logging shutdown regressions with weakrefs

Martin report at bugs.python.org
Wed Aug 4 00:39:41 CEST 2010

New submission from Martin <gzlist at googlemail.com>:

With the logging change to using weakrefs for handler cleanup done by the follow-on patch in issue 6615 exceptions may now be thrown during module teardown.

There are two distinct problem cases:
1) The new `_removeHandlerRef` function may run during teardown (when module globals are being set to None) but uses the module globals `_acquireLock`, `_releaseLock`, and `_handlerList`.
2) The `Handler.close` method no longer removes the instance from the module global list, this means if the caller then closes the underlying file but keeps a reference to the handler, the `shutdown` function will attempt to flush the already-closed file.

It may be that this new way of doing things is preferred and the response to closing underlying files or holding on to handler references is Don't Do That Then, but this seems like an accidental regression.

components: Library (Lib)
messages: 112713
nosy: flox, gz, vinay.sajip
priority: normal
severity: normal
status: open
title: Logging shutdown regressions with weakrefs
type: behavior
versions: Python 2.7, Python 3.2, Python 3.3

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list