]> granicus.if.org Git - python/commitdiff
Issue #9501: Improved shutdown handling to deal with module attributes correctly.
authorVinay Sajip <vinay_sajip@yahoo.co.uk>
Tue, 15 Jan 2013 17:55:57 +0000 (17:55 +0000)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>
Tue, 15 Jan 2013 17:55:57 +0000 (17:55 +0000)
Lib/logging/__init__.py

index 4da07f1d8bab98a606c6c3e4640512d4cc29ff0d..5cb2866d75b10438fc736a093b5baf5b1759aa07 100644 (file)
@@ -711,7 +711,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: