Issue #7014: logging: Improved IronPython 2.6 compatibility.
This commit is contained in:
parent
87b4e726be
commit
6d50b37b7c
|
@ -271,11 +271,14 @@ class LogRecord:
|
||||||
else:
|
else:
|
||||||
self.thread = None
|
self.thread = None
|
||||||
self.threadName = None
|
self.threadName = None
|
||||||
if logMultiprocessing:
|
if not logMultiprocessing:
|
||||||
from multiprocessing import current_process
|
|
||||||
self.processName = current_process().name
|
|
||||||
else:
|
|
||||||
self.processName = None
|
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'):
|
if logProcesses and hasattr(os, 'getpid'):
|
||||||
self.process = os.getpid()
|
self.process = os.getpid()
|
||||||
else:
|
else:
|
||||||
|
@ -1114,7 +1117,11 @@ class Logger(Filterer):
|
||||||
Find the stack frame of the caller so that we can note the source
|
Find the stack frame of the caller so that we can note the source
|
||||||
file name, line number and function name.
|
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)"
|
rv = "(unknown file)", 0, "(unknown function)"
|
||||||
while hasattr(f, "f_code"):
|
while hasattr(f, "f_code"):
|
||||||
co = f.f_code
|
co = f.f_code
|
||||||
|
|
Loading…
Reference in New Issue