diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2016-03-17 08:11:54 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2016-03-17 08:11:54 (GMT) |
commit | ec748c47ac2540fbc7b97e9d1efab1233003af1a (patch) | |
tree | aad4b1d233fb022ecae2053fd0e843a44e00206b /Lib | |
parent | 499d3654a86a55ce7b727a31b6fea8e1ddb04508 (diff) | |
parent | 5c13aa156255d672aeee4d32bc0965e20c7d6c51 (diff) | |
download | cpython-ec748c47ac2540fbc7b97e9d1efab1233003af1a.zip cpython-ec748c47ac2540fbc7b97e9d1efab1233003af1a.tar.gz cpython-ec748c47ac2540fbc7b97e9d1efab1233003af1a.tar.bz2 |
Merge 3.5
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/pyclbr.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Lib/pyclbr.py b/Lib/pyclbr.py index dd58ada..4d40b87 100644 --- a/Lib/pyclbr.py +++ b/Lib/pyclbr.py @@ -142,10 +142,10 @@ def _readmodule(module, path, inpackage=None): search_path = path + sys.path # XXX This will change once issue19944 lands. spec = importlib.util._find_spec_from_path(fullmodule, search_path) - fname = spec.loader.get_filename(fullmodule) _modules[fullmodule] = dict - if spec.loader.is_package(fullmodule): - dict['__path__'] = [os.path.dirname(fname)] + # is module a package? + if spec.submodule_search_locations is not None: + dict['__path__'] = spec.submodule_search_locations try: source = spec.loader.get_source(fullmodule) if source is None: @@ -154,6 +154,8 @@ def _readmodule(module, path, inpackage=None): # not Python source, can't do anything with this module return dict + fname = spec.loader.get_filename(fullmodule) + f = io.StringIO(source) stack = [] # stack of (class, indent) pairs |