Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b672b6d

Browse files
committed
#5287: Add exception handling around findCaller() call to help out IronPython.
1 parent 2d0c256 commit b672b6d

2 files changed

Lines changed: 15 additions & 7 deletions

File tree

Lib/logging/__init__.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2001-2008 by Vinay Sajip. All Rights Reserved.
1+
# Copyright 2001-2009 by Vinay Sajip. All Rights Reserved.
22
#
33
# Permission to use, copy, modify, and distribute this software and its
44
# documentation for any purpose and without fee is hereby granted,
@@ -1127,7 +1127,12 @@ def _log(self, level, msg, args, exc_info=None, extra=None):
11271127
all the handlers of this logger to handle the record.
11281128
"""
11291129
if _srcfile:
1130-
fn, lno, func = self.findCaller()
1130+
#IronPython doesn't track Python frames, so findCaller throws an
1131+
#exception. We trap it here so that IronPython can use logging.
1132+
try:
1133+
fn, lno, func = self.findCaller()
1134+
except ValueError:
1135+
fn, lno, func = "(unknown file)", 0, "(unknown function)"
11311136
else:
11321137
fn, lno, func = "(unknown file)", 0, "(unknown function)"
11331138
if exc_info:

Misc/NEWS

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -169,15 +169,18 @@ Core and Builtins
169169
Library
170170
-------
171171

172+
- Issue #5287: Add exception handling around findCaller() call to help out
173+
IronPython.
174+
172175
- Issue #5282: Fixed mmap resize on 32bit windows and unix. When offset > 0,
173176
The file was resized to wrong size.
174177

175178
- Issue #5292: Fixed mmap crash on its boundary access m[len(m)].
176179

177-
- Issue #2279: distutils.sdist.add_defaults now add files
180+
- Issue #2279: distutils.sdist.add_defaults now add files
178181
from the package_data and the data_files metadata.
179182

180-
- Issue #5257: refactored all tests in distutils, so they use
183+
- Issue #5257: refactored all tests in distutils, so they use
181184
support.TempdirManager, to avoid writing in the tests directory.
182185

183186
- Issue #4524: distutils build_script command failed with --with-suffix=3.
@@ -227,13 +230,13 @@ Library
227230
- Issue #4285: Change sys.version_info to be a named tuple. Patch by
228231
Ross Light.
229232

230-
- Issue #1520877: Now distutils.sysconfig reads $AR from the
233+
- Issue #1520877: Now distutils.sysconfig reads $AR from the
231234
environment/Makefile. Patch by Douglas Greiman.
232235

233236
- Issue #1276768: The verbose option was not used in the code of
234237
distutils.file_util and distutils.dir_util.
235238

236-
- Issue #5132: Fixed trouble building extensions under Solaris with
239+
- Issue #5132: Fixed trouble building extensions under Solaris with
237240
--enabled-shared activated. Initial patch by Dave Peterson.
238241

239242
- Issue #1581476: Always use the Tcl global namespace when calling into Tcl.
@@ -283,7 +286,7 @@ Library
283286
- Issue #4710: Extract directories properly in the zipfile module;
284287
allow adding directories to a zipfile.
285288

286-
- Issue #3807: _multiprocessing build fails when configure is passed
289+
- Issue #3807: _multiprocessing build fails when configure is passed
287290
--without-threads argument. When this occurs, _multiprocessing will
288291
be disabled, and not compiled.
289292

0 commit comments

Comments
 (0)