From 437d9af5a9674a5b4fbd146a46528bde50b199bb Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Thu, 19 Jan 2012 18:49:19 +0100 Subject: [PATCH] don't iterate through names in __all__ which are not valid Python identifiers (PY-5503) --- python/src/com/jetbrains/python/psi/impl/PyFileImpl.java | 3 +++ python/testData/completion/dunderAll/importSource.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/python/src/com/jetbrains/python/psi/impl/PyFileImpl.java b/python/src/com/jetbrains/python/psi/impl/PyFileImpl.java index 45afb580a752..1d8724b71588 100644 --- a/python/src/com/jetbrains/python/psi/impl/PyFileImpl.java +++ b/python/src/com/jetbrains/python/psi/impl/PyFileImpl.java @@ -185,6 +185,9 @@ public class PyFileImpl extends PsiFileBase implements PyFile, PyExpression { if (remainingDunderAll != null) { for (String s: remainingDunderAll) { + if (!PyNames.isIdentifier(s)) { + continue; + } if (!processor.execute(new LightNamedElement(myManager, PythonLanguage.getInstance(), s), resolveState)) return false; } } diff --git a/python/testData/completion/dunderAll/importSource.py b/python/testData/completion/dunderAll/importSource.py index 97370355b4c1..a2ad38778017 100644 --- a/python/testData/completion/dunderAll/importSource.py +++ b/python/testData/completion/dunderAll/importSource.py @@ -1,2 +1,2 @@ -__all__ = ['xyzzy', 'shazam'] +__all__ = ['xyzzy', 'shazam', 'xy is not a valid python identifier']