From: Vinay Sajip Date: Tue, 17 Feb 2009 17:47:15 +0000 (+0000) Subject: #5287: Add exception handling around findCaller() call to help out IronPython. X-Git-Tag: v2.6.2c1~161 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=834704209393be146dd5f786f25a2f34884d1a78;p=thirdparty%2FPython%2Fcpython.git #5287: Add exception handling around findCaller() call to help out IronPython. --- diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py index dd44b67aac7a..90fe5816719d 100644 --- a/Lib/logging/__init__.py +++ b/Lib/logging/__init__.py @@ -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, @@ -44,7 +44,7 @@ except ImportError: __author__ = "Vinay Sajip " __status__ = "production" __version__ = "0.5.0.5" -__date__ = "20 January 2009" +__date__ = "17 February 2009" #--------------------------------------------------------------------------- # Miscellaneous module data @@ -1118,7 +1118,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: diff --git a/Misc/NEWS b/Misc/NEWS index 9b734d0973d0..45d145e9209c 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -80,6 +80,9 @@ Core and Builtins Library ------- +- Issue #5287: Add exception handling around findCaller() call in logging to + help out IronPython. + - Issue #4524: distutils build_script command failed with --with-suffix=3. Initial patch by Amaury Forgeot d'Arc.