mirror of
https://github.com/python/cpython.git
synced 2025-08-31 22:18:28 +00:00
merge from 3.2
This commit is contained in:
commit
9403071277
3 changed files with 75 additions and 45 deletions
|
@ -191,8 +191,11 @@ class ImpImporter:
|
|||
|
||||
yielded = {}
|
||||
import inspect
|
||||
|
||||
filenames = os.listdir(self.path)
|
||||
try:
|
||||
filenames = os.listdir(self.path)
|
||||
except OSError:
|
||||
# ignore unreadable directories like import does
|
||||
filenames = []
|
||||
filenames.sort() # handle packages before same-named modules
|
||||
|
||||
for fn in filenames:
|
||||
|
@ -205,7 +208,12 @@ class ImpImporter:
|
|||
|
||||
if not modname and os.path.isdir(path) and '.' not in fn:
|
||||
modname = fn
|
||||
for fn in os.listdir(path):
|
||||
try:
|
||||
dircontents = os.listdir(path)
|
||||
except OSError:
|
||||
# ignore unreadable directories like import does
|
||||
dircontents = []
|
||||
for fn in dircontents:
|
||||
subname = inspect.getmodulename(fn)
|
||||
if subname=='__init__':
|
||||
ispkg = True
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue