Vinay Sajip avatar Vinay Sajip committed a8d0e76

Issue #7014: logging: Improved IronPython 2.6 compatibility.

Comments (0)

Files changed (1)

Lib/logging/__init__.py

         else:
             self.thread = None
             self.threadName = None
-        if logMultiprocessing:
-            from multiprocessing import current_process
-            self.processName = current_process().name
+        if not logMultiprocessing:
+            self.processName = None
         else:
-            self.processName = None
+            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:
         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
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.