This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author belopolsky
Recipients belopolsky, exarkun, gpolo, loewis
Date 2008-10-28.22:46:58
SpamBayes Score 8.1142576e-10
Marked as misclassified No
Message-id <1225234020.41.0.982262119532.issue4223@psf.upfronthosting.co.za>
In-reply-to
Content
Thanks, Jean-Paul, I can now reproduce your problem and I think I found 
the culprit.

I believe the file name check in linecache.updatecache is unnecessary 
and is responsible for this problem.  With the following patch:

--- Lib/linecache.py	(revision 67040)
+++ Lib/linecache.py	(working copy)
@@ -88,7 +88,7 @@
             get_source = getattr(loader, 'get_source', None)
 
             if name and get_source:
-                if basename.startswith(name.split('.')[-1]+'.'):
+#                if basename.startswith(name.split('.')[-1]+'.'):
                     try:
                         data = get_source(name)
                     except (ImportError, IOError):


and Jean-Paul's foobar:

$ PYTHONPATH=/tmp/foobar.zip ./python.exe  -c "import inspect,foobar; 
print inspect.getsource(foobar)"
def foo(): pass


Martin, is there a chance for this issue and  #4197, #4201  to make it 
to 2.5.3?  If so, I'll prepare a combined patch with tests for your 
consideration shortly.
History
Date User Action Args
2008-10-28 22:47:00belopolskysetrecipients: + belopolsky, loewis, exarkun, gpolo
2008-10-28 22:47:00belopolskysetmessageid: <1225234020.41.0.982262119532.issue4223@psf.upfronthosting.co.za>
2008-10-28 22:46:59belopolskylinkissue4223 messages
2008-10-28 22:46:58belopolskycreate