[ python-Patches-1738179 ] help() can't find right source file

"SourceForge.net" <[email protected]>
Newsgroups gmane.comp.python.patches
Message-ID <[email protected]>
Patches item #1738179, was opened at 2007-06-15 17:17
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=1738179&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.5
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Greg Couch (gregcouch)
Assigned to: Nobody/Anonymous (nobody)
Summary: help() can't find right source file

Initial Comment:
The problem occurs when Python modules are precompiled with the the compileall module and the -d option to give a simpiler directory name (we use the application name because when we get error reports, where the application was installed is rarely important).  Then introspection on a function in the inspect module gives a "non-existent" filename, i.e., func.func_code.co_filename gives the name for backtraces, not the actual filename.  The right answer can be found by looking at sys.modules[func.__module__].__file__ and the attached patch does that.

This patch is against Python2.4's Lib/inspect.py, but the bug is still present in SVN (Python 2.5.1+).

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

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1738179&group_id=5470
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.