aboutsummaryrefslogtreecommitdiff
path: root/examples/python2.7/patches/linecache.diff
blob: a7fdd5a318d9a9341d118a38b97022757aeb7462 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# DP: Proper handling of packages in linecache.py

--- a/Lib/linecache.py
+++ b/Lib/linecache.py
@@ -108,6 +108,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:
             # When using imputil, sys.path may contain things other than
             # strings; ignore them when it happens.