]> granicus.if.org Git - python/commitdiff
#5287: Add exception handling around findCaller() call to help out IronPython.
authorVinay Sajip <vinay_sajip@yahoo.co.uk>
Thu, 19 Feb 2009 12:31:32 +0000 (12:31 +0000)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>
Thu, 19 Feb 2009 12:31:32 +0000 (12:31 +0000)
Lib/logging/__init__.py
Misc/NEWS

index 8773225b2466d8cb00af956aa50f7e6c9dbf1340..e7eb51df3bdc280b9fb0400c886ff25ffc6679df 100644 (file)
@@ -1128,7 +1128,12 @@ class Logger(Filterer):
         all the handlers of this logger to handle the record.
         """
         if _srcfile:
-            fn, lno, func = self.findCaller()
+            #IronPython doesn't track Python frames, so findCaller throws an
+            #exception. We trap it here so that IronPython can use logging.
+            try:
+                fn, lno, func = self.findCaller()
+            except ValueError:
+                fn, lno, func = "(unknown file)", 0, "(unknown function)"
         else:
             fn, lno, func = "(unknown file)", 0, "(unknown function)"
         if exc_info:
index aaa702b5fcf8befc96d8695167a4f518fde958b5..6a65384b8e687eb4a0047c366a1051df222356a7 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -161,16 +161,18 @@ Core and Builtins
 
 Library
 -------
+- Issue #5287: Add exception handling around findCaller() call to help out
+  IronPython.
 
 - Issue #5282: Fixed mmap resize on 32bit windows and unix. When offset > 0,
   The file was resized to wrong size.
 
 - Issue #5292: Fixed mmap crash on its boundary access m[len(m)].
 
-- Issue #2279: distutils.sdist.add_defaults now add files 
+- Issue #2279: distutils.sdist.add_defaults now add files
   from the package_data and the data_files metadata.
 
-- Issue #5257: refactored all tests in distutils, so they use 
+- Issue #5257: refactored all tests in distutils, so they use
   support.TempdirManager, to avoid writing in the tests directory.
 
 - Issue #4524: distutils build_script command failed with --with-suffix=3.