]> 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:36:11 +0000 (12:36 +0000)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>
Thu, 19 Feb 2009 12:36:11 +0000 (12:36 +0000)
Lib/logging/__init__.py
Misc/NEWS

index 231e8c2340dbcfa586311abdda7ac1b50231e246..e294880f9f39504b1655630a9c63c30be2f76325 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2001-2008 by Vinay Sajip. All Rights Reserved.
+# Copyright 2001-2009 by Vinay Sajip. All Rights Reserved.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose and without fee is hereby granted,
@@ -1127,7 +1127,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 e89c81995185a65ff0a38af7234545accb9b51bd..33a4098067ae90881c7a741a96a2a6528bd8cbcd 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -169,15 +169,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.
@@ -227,13 +230,13 @@ Library
 - Issue #4285: Change sys.version_info to be a named tuple. Patch by
   Ross Light.
 
-- Issue #1520877: Now distutils.sysconfig reads $AR from the 
+- Issue #1520877: Now distutils.sysconfig reads $AR from the
   environment/Makefile. Patch by Douglas Greiman.
 
 - Issue #1276768: The verbose option was not used in the code of
   distutils.file_util and distutils.dir_util.
 
-- Issue #5132: Fixed trouble building extensions under Solaris with 
+- Issue #5132: Fixed trouble building extensions under Solaris with
   --enabled-shared activated. Initial patch by Dave Peterson.
 
 - Issue #1581476: Always use the Tcl global namespace when calling into Tcl.
@@ -283,7 +286,7 @@ Library
 - Issue #4710: Extract directories properly in the zipfile module;
   allow adding directories to a zipfile.
 
-- Issue #3807: _multiprocessing build fails when configure is passed 
+- Issue #3807: _multiprocessing build fails when configure is passed
   --without-threads argument. When this occurs, _multiprocessing will
   be disabled, and not compiled.