[Python-checkins] r43048 - python/trunk/Lib/logging/__init__.py
vinay.sajip
python-checkins at python.org
Wed Mar 15 13:45:08 CET 2006
Author: vinay.sajip
Date: Wed Mar 15 13:45:07 2006
New Revision: 43048
Modified:
python/trunk/Lib/logging/__init__.py
Log:
Catch situations where currentframe() returns None. See SF patch #1447410, this is a different implementation.
Modified: python/trunk/Lib/logging/__init__.py
==============================================================================
--- python/trunk/Lib/logging/__init__.py (original)
+++ python/trunk/Lib/logging/__init__.py Wed Mar 15 13:45:07 2006
@@ -1058,13 +1058,16 @@
file name, line number and function name.
"""
f = currentframe().f_back
- while 1:
+ rv = "(unknown file)", 0, "(unknown function)"
+ while hasattr(f, "f_code"):
co = f.f_code
filename = os.path.normcase(co.co_filename)
if filename == _srcfile:
f = f.f_back
continue
- return filename, f.f_lineno, co.co_name
+ rv = (filename, f.f_lineno, co.co_name)
+ break
+ return rv
def makeRecord(self, name, level, fn, lno, msg, args, exc_info, func=None, extra=None):
"""
More information about the Python-checkins
mailing list