mirror of
https://github.com/python/cpython.git
synced 2025-11-03 03:22:27 +00:00
Issue 11718: Teach IDLE's open module dialog to find packages.
This commit is contained in:
parent
d16ee63df2
commit
820ae36b8d
1 changed files with 11 additions and 0 deletions
|
|
@ -50,6 +50,17 @@ def _find_module(fullname, path=None):
|
||||||
path = module.__path__
|
path = module.__path__
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
raise ImportError('No source for module ' + module.__name__)
|
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
|
return file, filename, descr
|
||||||
|
|
||||||
class EditorWindow(object):
|
class EditorWindow(object):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue