summaryrefslogtreecommitdiff
path: root/astroid
diff options
context:
space:
mode:
authorJacob Walls <jacobtylerwalls@gmail.com>2021-12-07 17:06:19 -0500
committerGitHub <noreply@github.com>2021-12-07 23:06:19 +0100
commit6ac6b909bfa18883d46cd15981629e84c5bd949e (patch)
tree3362a577de547ab8afde17f7c03f3c8b37c051b0 /astroid
parente13c3402b08ecdb399a9c611bac61333a431f609 (diff)
downloadastroid-git-6ac6b909bfa18883d46cd15981629e84c5bd949e.tar.gz
Fix crash if a variable named "type" is subscripted in a generator expression (#1285)
Co-authored-by Marc Mueller <30130371+cdce8p@users.noreply.github.com>
Diffstat (limited to 'astroid')
-rw-r--r--astroid/brain/brain_type.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/astroid/brain/brain_type.py b/astroid/brain/brain_type.py
index d0eddd22..9d694e62 100644
--- a/astroid/brain/brain_type.py
+++ b/astroid/brain/brain_type.py
@@ -48,7 +48,7 @@ def infer_type_sub(node, context=None):
:rtype: nodes.NodeNG
"""
node_scope, _ = node.scope().lookup("type")
- if node_scope.qname() != "builtins":
+ if not isinstance(node_scope, nodes.Module) or node_scope.qname() != "builtins":
raise UseInferenceDefault()
class_src = """
class type: