get_module_part should be given a context_file. Closes pyreverse crash #92362

authorSylvain Th?nault <sylvain.thenault@logilab.fr>
changeset27ca2820b32b
branchstable
phasepublic
hiddenno
parent revision#301a4b1cc7a7 default is stable
child revision#b261077ba24c default is stable
files modified by this revision
ChangeLog
inspector.py
# HG changeset patch
# User Sylvain Thénault <sylvain.thenault@logilab.fr>
# Date 1335280571 -7200
# Tue Apr 24 17:16:11 2012 +0200
# Branch stable
# Node ID 27ca2820b32b05430021e6ee95b6184c0f6ebca8
# Parent 301a4b1cc7a786d30c0f8ee5b0f10a044a2cdfc5
get_module_part should be given a context_file. Closes pyreverse crash #92362

diff --git a/ChangeLog b/ChangeLog
@@ -1,8 +1,11 @@
1  Change log for the astng package
2  ================================
3 
4 +  --
5 + * #92362: fix pyreverse crash on relative import
6 +
7  2011-12-08  --  0.23.1
8      * #62295: avoid "OSError: Too many open files" by moving
9        .file_stream as a Module property opening the file only when needed
10 
11      * Lambda nodes should have a `name` attribute
diff --git a/inspector.py b/inspector.py
@@ -252,11 +252,11 @@
12              # analyze dependencies
13              fullname = '%s.%s' % (basename, name[0])
14              if fullname.find('.') > -1:
15                  try:
16                      # XXX: don't use get_module_part, missing package precedence
17 -                    fullname = get_module_part(fullname)
18 +                    fullname = get_module_part(fullname, context_file)
19                  except ImportError:
20                      continue
21              if fullname != basename:
22                  self._imported_module(node, fullname, relative)
23