From: Vinay Sajip Date: Tue, 15 Jan 2013 17:55:13 +0000 (+0000) Subject: Issue #9501: Improved shutdown handling to deal with module attributes correctly. X-Git-Tag: v2.7.4rc1~241 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=51b55517a1bef84fc6c508f3eb0ef921148283eb;p=thirdparty%2FPython%2Fcpython.git Issue #9501: Improved shutdown handling to deal with module attributes correctly. --- diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py index e53718d74577..1a622a3d0747 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: