summaryrefslogtreecommitdiffstats
path: root/Lib/logging
diff options
context:
space:
mode:
authorVinay Sajip <vinay_sajip@yahoo.co.uk>2009-02-19 12:36:11 (GMT)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>2009-02-19 12:36:11 (GMT)
commitb672b6dea65dfae3c8ad04591642e8835f499da2 (patch)
treebd3a6a70ca99781b7e3f91e01468ddf4b6266f14 /Lib/logging
parent2d0c2568d51cbaae1309ab7261ceb57cde9719d6 (diff)
downloadcpython-b672b6dea65dfae3c8ad04591642e8835f499da2.zip
cpython-b672b6dea65dfae3c8ad04591642e8835f499da2.tar.gz
cpython-b672b6dea65dfae3c8ad04591642e8835f499da2.tar.bz2
#5287: Add exception handling around findCaller() call to help out IronPython.
Diffstat (limited to 'Lib/logging')
-rw-r--r--Lib/logging/__init__.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py
index 231e8c2..e294880 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,
@@ -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: