summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
Diffstat (limited to 'Lib')
-rw-r--r--Lib/logging/__init__.py8
1 files changed, 3 insertions, 5 deletions
diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py
index 033fecd..e64d86b 100644
--- a/Lib/logging/__init__.py
+++ b/Lib/logging/__init__.py
@@ -284,12 +284,10 @@ class LogRecord:
self.threadName = None
if not logMultiprocessing:
self.processName = None
+ elif 'multiprocessing' not in sys.modules:
+ self.processName = 'MainProcess'
else:
- try:
- from multiprocessing import current_process
- self.processName = current_process().name
- except ImportError:
- self.processName = None
+ self.processName = sys.modules['multiprocessing'].current_process().name
if logProcesses and hasattr(os, 'getpid'):
self.process = os.getpid()
else: