From: Vinay Sajip Date: Thu, 19 Feb 2009 12:36:11 +0000 (+0000) Subject: #5287: Add exception handling around findCaller() call to help out IronPython. X-Git-Tag: v3.1a1~136 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b672b6dea65dfae3c8ad04591642e8835f499da2;p=python #5287: Add exception handling around findCaller() call to help out IronPython. --- diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py index 231e8c2340..e294880f9f 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: diff --git a/Misc/NEWS b/Misc/NEWS index e89c819951..33a4098067 100644 --- 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.