Issue #7403: Fixed possible race condition in lock creation.
diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py
index 3fe03cd..03c67b0 100644
--- a/Lib/logging/__init__.py
+++ b/Lib/logging/__init__.py
@@ -186,7 +186,10 @@
 #the lock would already have been acquired - so we need an RLock.
 #The same argument applies to Loggers and Manager.loggerDict.
 #
-_lock = None
+if thread:
+    _lock = threading.RLock()
+else:
+    _lock = None
 
 def _acquireLock():
     """
@@ -194,9 +197,6 @@
 
     This should be released with _releaseLock().
     """
-    global _lock
-    if (not _lock) and thread:
-        _lock = threading.RLock()
     if _lock:
         _lock.acquire()
 
diff --git a/Misc/NEWS b/Misc/NEWS
index 746e342..ca36adc 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -33,6 +33,8 @@
 Library
 -------
 
+- Issue #7403: logging: Fixed possible race condition in lock creation.
+
 - Issue #7341: Close the internal file object in the TarFile constructor in
   case of an error.