summaryrefslogtreecommitdiffstats
path: root/Lib/logging
diff options
context:
space:
mode:
authorVinay Sajip <vinay_sajip@yahoo.co.uk>2009-09-29 07:11:53 (GMT)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>2009-09-29 07:11:53 (GMT)
commit6d50b37b7c5c4cf5d38c36ba23b4db118336c728 (patch)
tree002700f33eb3b8b8b7b1591e0dd3935a7853f365 /Lib/logging
parent87b4e726bed0dfa7071ffc5528969039a96ea0c4 (diff)
downloadcpython-6d50b37b7c5c4cf5d38c36ba23b4db118336c728.zip
cpython-6d50b37b7c5c4cf5d38c36ba23b4db118336c728.tar.gz
cpython-6d50b37b7c5c4cf5d38c36ba23b4db118336c728.tar.bz2
Issue #7014: logging: Improved IronPython 2.6 compatibility.
Diffstat (limited to 'Lib/logging')
-rw-r--r--Lib/logging/__init__.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py
index c1678b7..2b8a021 100644
--- a/Lib/logging/__init__.py
+++ b/Lib/logging/__init__.py
@@ -271,11 +271,14 @@ class LogRecord:
else:
self.thread = None
self.threadName = None
- if logMultiprocessing:
- from multiprocessing import current_process
- self.processName = current_process().name
- else:
+ if not logMultiprocessing:
self.processName = None
+ else:
+ try:
+ from multiprocessing import current_process
+ self.processName = current_process().name
+ except ImportError:
+ self.processName = None
if logProcesses and hasattr(os, 'getpid'):
self.process = os.getpid()
else:
@@ -1114,7 +1117,11 @@ class Logger(Filterer):
Find the stack frame of the caller so that we can note the source
file name, line number and function name.
"""
- f = currentframe().f_back
+ f = currentframe()
+ #On some versions of IronPython, currentframe() returns None if
+ #IronPython isn't run with -X:Frames.
+ if f is not None:
+ f = f.f_back
rv = "(unknown file)", 0, "(unknown function)"
while hasattr(f, "f_code"):
co = f.f_code