[Patches] [ python-Patches-1447410 ] logging: findCaller() sometimes raises AttributeError

SourceForge.net noreply at sourceforge.net
Fri Mar 10 19:12:38 CET 2006


Patches item #1447410, was opened at 2006-03-10 10:12
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1447410&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Library (Lib)
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Kevin J Bluck (kbluck)
Assigned to: Nobody/Anonymous (nobody)
Summary: logging: findCaller() sometimes raises AttributeError

Initial Comment:
I am invoking the logging.log() function via the C API,
using PyObject_CallFunction(). I have found that
sometimes (not always) the findCaller() function raises
this AttributeError:

AttributeError: 'NoneType' object has no attribute 'f_code'
  File "C:\Program
Files\Python\Lib\logging\__init__.py", line 1052, in
findCaller
    co = f.f_code
  File "C:\Program
Files\Python\Lib\logging\__init__.py", line 1078, in _log
    fn, lno, func = self.findCaller()
  File "C:\Program
Files\Python\Lib\logging\__init__.py", line 1043, in log
    apply(self._log, (level, msg, args), kwargs)
  File "C:\Program
Files\Python\Lib\logging\__init__.py", line 1319, in log
    apply(root

It appears that sometimes, currentframe() is returning
None.

Attached is a patch for logging/__init__.py which
guards against this possibility. Patch is generated
against recent SVN head revision 42958.


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1447410&group_id=5470


More information about the Patches mailing list