Skip to content

Commit dbab0c4

Browse files
committed
Micro-optimize CallableType.__init__
1 parent 7e002e5 commit dbab0c4

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

mypy/types.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2104,14 +2104,14 @@ def __init__(
21042104
) -> None:
21052105
super().__init__(line, column)
21062106
assert len(arg_types) == len(arg_kinds) == len(arg_names)
2107-
for t, k in zip(arg_types, arg_kinds):
2107+
if variables is None:
2108+
variables = []
2109+
self.arg_types = list(arg_types)
2110+
for t in self.arg_types:
21082111
if isinstance(t, ParamSpecType):
21092112
assert not t.prefix.arg_types
21102113
# TODO: should we assert that only ARG_STAR contain ParamSpecType?
21112114
# See testParamSpecJoin, that relies on passing e.g `P.args` as plain argument.
2112-
if variables is None:
2113-
variables = []
2114-
self.arg_types = list(arg_types)
21152115
self.arg_kinds = arg_kinds
21162116
self.arg_names = list(arg_names)
21172117
self.min_args = arg_kinds.count(ARG_POS)

0 commit comments

Comments
 (0)