# DP: Proper handling of packages in linecache.py --- a/Lib/linecache.py +++ b/Lib/linecache.py @@ -109,6 +109,11 @@ if os.path.isabs(filename): return [] + # Take care to handle packages. + if basename == '__init__.py': + # filename referes to a package + basename = filename + for dirname in sys.path: try: fullname = os.path.join(dirname, basename)