]> granicus.if.org Git - python/commitdiff
Issue 11718: Teach IDLE's open module dialog to find packages.
authorRaymond Hettinger <python@rcn.com>
Wed, 13 Apr 2011 01:30:14 +0000 (18:30 -0700)
committerRaymond Hettinger <python@rcn.com>
Wed, 13 Apr 2011 01:30:14 +0000 (18:30 -0700)
Lib/idlelib/EditorWindow.py
Misc/NEWS

index ffc4e88d9d456c0d61b4f62063e8e65337a6b26b..3b7bb6df6f05d5b0c4cc470622a545e8cdb0f8c1 100644 (file)
@@ -50,6 +50,17 @@ def _find_module(fullname, path=None):
             path = module.__path__
         except AttributeError:
             raise ImportError('No source for module ' + module.__name__)
+    if descr[2] != imp.PY_SOURCE:
+        # If all of the above fails and didn't raise an exception,fallback
+        # to a straight import which can find __init__.py in a package.
+        m = __import__(fullname)
+        try:
+            filename = m.__file__
+        except AttributeError:
+            pass
+        else:
+            file = None
+            descr = os.path.splitext(filename), None, imp.PY_SOURCE
     return file, filename, descr
 
 class EditorWindow(object):
index af3ad9ac9a61730736082f4d42c9bfd30af56598..253f8543d092ba85cb3eb95ebb7dc5ae02d9bf0c 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -224,6 +224,12 @@ Build
 - Issue #11268: Prevent Mac OS X Installer failure if Documentation
   package had previously been installed.
 
+IDLE
+----
+
+- Issue #11718: IDLE's open module dialog couldn't find the __init__.py
+  file in a package.
+
 Tools/Demos
 -----------