diff options
author | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2009-02-19 12:31:32 (GMT) |
---|---|---|
committer | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2009-02-19 12:31:32 (GMT) |
commit | 1a0d2befeaf445a2a7094744b30e7cab1492c340 (patch) | |
tree | 344562adce503bb2f36eda72f767c8b38c2d86a2 /Lib/logging | |
parent | 8f9a1eee0d99710801117dc313f5588c2a6c22b1 (diff) | |
download | cpython-1a0d2befeaf445a2a7094744b30e7cab1492c340.zip cpython-1a0d2befeaf445a2a7094744b30e7cab1492c340.tar.gz cpython-1a0d2befeaf445a2a7094744b30e7cab1492c340.tar.bz2 |
#5287: Add exception handling around findCaller() call to help out IronPython.
Diffstat (limited to 'Lib/logging')
-rw-r--r-- | Lib/logging/__init__.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py index 8773225..e7eb51d 100644 --- a/Lib/logging/__init__.py +++ b/Lib/logging/__init__.py @@ -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: |