Skip to content

Commit 0f78f9c

Browse files
authored
Use cache for DictExpr as well (#19536)
Fixes #14271 Fixes #14636 TBH examples in those issues are already sufficiently fast (probably because of combined effect of fast dict literals, and the fact that there are some lists and/or function calls in that examples, so some caching already kicks in). But this PR will probably make them even faster. This has ~0 effect on self-check.
1 parent c53367f commit 0f78f9c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mypy/checkexpr.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6043,7 +6043,7 @@ def accept(
60436043
# We cannot use cache inside lambdas, because they skip immediate type
60446044
# context, and use enclosing one, see infer_lambda_type_using_context().
60456045
# TODO: consider using cache for more expression kinds.
6046-
elif isinstance(node, (CallExpr, ListExpr, TupleExpr, OpExpr)) and not (
6046+
elif isinstance(node, (CallExpr, ListExpr, TupleExpr, DictExpr, OpExpr)) and not (
60476047
self.in_lambda_expr or self.chk.current_node_deferred
60486048
):
60496049
if (node, type_context) in self.expr_cache:

0 commit comments

Comments
 (0)