From c4af1360fee2ca77af520095d9c2fc4928b682cb Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Tue, 21 Aug 2012 17:18:33 +0200 Subject: [PATCH] EA-38364 - IAE: PsiTreeUtil.isAncestor --- .../python/codeInsight/imports/PythonReferenceImporter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/src/com/jetbrains/python/codeInsight/imports/PythonReferenceImporter.java b/python/src/com/jetbrains/python/codeInsight/imports/PythonReferenceImporter.java index 1bd3a88d43f7..ff45a27fb12a 100644 --- a/python/src/com/jetbrains/python/codeInsight/imports/PythonReferenceImporter.java +++ b/python/src/com/jetbrains/python/codeInsight/imports/PythonReferenceImporter.java @@ -173,7 +173,7 @@ public class PythonReferenceImporter implements ReferenceImporter { PyFileImpl importSourceFile = (PyFileImpl)sourceFile; PsiElement res = importSourceFile.findExportedName(refText); // allow importing from this source if it either declares the name itself or represents a higher-level package that reexports the name - if (res != null && !(res instanceof PyFile) && !(res instanceof PyImportElement) && + if (res != null && !(res instanceof PyFile) && !(res instanceof PyImportElement) && res.getContainingFile() != null && PsiTreeUtil.isAncestor(source, res.getContainingFile(), false)) { existingImportFile = importSourceFile; fix.addImport(res, importSourceFile, importElement);