Commit 83470420 authored by Vinay Sajip's avatar Vinay Sajip

#5287: Add exception handling around findCaller() call to help out IronPython.

parent 62ba5af0
# 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 # Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted, # documentation for any purpose and without fee is hereby granted,
...@@ -44,7 +44,7 @@ except ImportError: ...@@ -44,7 +44,7 @@ except ImportError:
__author__ = "Vinay Sajip <vinay_sajip@red-dove.com>" __author__ = "Vinay Sajip <vinay_sajip@red-dove.com>"
__status__ = "production" __status__ = "production"
__version__ = "0.5.0.5" __version__ = "0.5.0.5"
__date__ = "20 January 2009" __date__ = "17 February 2009"
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# Miscellaneous module data # Miscellaneous module data
...@@ -1118,7 +1118,12 @@ class Logger(Filterer): ...@@ -1118,7 +1118,12 @@ class Logger(Filterer):
all the handlers of this logger to handle the record. all the handlers of this logger to handle the record.
""" """
if _srcfile: 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: else:
fn, lno, func = "(unknown file)", 0, "(unknown function)" fn, lno, func = "(unknown file)", 0, "(unknown function)"
if exc_info: if exc_info:
......
...@@ -80,6 +80,9 @@ Core and Builtins ...@@ -80,6 +80,9 @@ Core and Builtins
Library 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. - Issue #4524: distutils build_script command failed with --with-suffix=3.
Initial patch by Amaury Forgeot d'Arc. Initial patch by Amaury Forgeot d'Arc.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment