summaryrefslogtreecommitdiff
path: root/Lib/logging
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/logging')
-rw-r--r--Lib/logging/__init__.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py
index b8e7b377b3..244c91536e 100644
--- a/Lib/logging/__init__.py
+++ b/Lib/logging/__init__.py
@@ -708,7 +708,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: