Skip to content

Commit

Permalink
Fix a crash caused by trying to look up typing.Any in typing.pytd.
Browse files Browse the repository at this point in the history
Any is special-cased.

PiperOrigin-RevId: 449574289
  • Loading branch information
rchen152 committed May 19, 2022
1 parent a55a159 commit 131be54
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pytype/abstract/_typing.py
Expand Up @@ -632,7 +632,10 @@ def resolve(self, node, f_globals, f_locals):
mod = self.ctx.loader.import_name("typing")
for v in self._imports["typing"]:
if v not in f_globals.members:
typ = self.ctx.convert.name_to_value(f"typing.{v}", ast=mod)
if v == "Any":
typ = self.ctx.convert.unsolvable
else:
typ = self.ctx.convert.name_to_value(f"typing.{v}", ast=mod)
f_globals.members[v] = typ.to_variable(node)
var, errorlog = abstract_utils.eval_expr(self.ctx, node, f_globals,
f_locals, self.expr)
Expand Down

0 comments on commit 131be54

Please sign in to comment.