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. |