From 51b55517a1bef84fc6c508f3eb0ef921148283eb Mon Sep 17 00:00:00 2001 From: Vinay Sajip Date: Tue, 15 Jan 2013 17:55:13 +0000 Subject: [PATCH] Issue #9501: Improved shutdown handling to deal with module attributes correctly. --- Lib/logging/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py index e53718d7457..1a622a3d074 100644 --- a/Lib/logging/__init__.py +++ b/Lib/logging/__init__.py @@ -624,7 +624,8 @@ def _removeHandlerRef(wr): # This function can be called during module teardown, when globals are # set to None. If _acquireLock is None, assume this is the case and do # nothing. - if _acquireLock is not None: + if (_acquireLock is not None and _handlerList is not None and + _releaseLock is not None): _acquireLock() try: if wr in _handlerList: