From bccaea2f237699fd3be6db9ab4646ac61e28f28a Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Sun, 9 Jun 2024 13:35:01 +0100 Subject: [PATCH] simplify --- Lib/typing.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Lib/typing.py b/Lib/typing.py index 76e49d6855c3c1..dc1024dabe5e87 100644 --- a/Lib/typing.py +++ b/Lib/typing.py @@ -1069,15 +1069,15 @@ def _evaluate(self, globalns, localns, type_params=_sentinel, *, recursive_guard # but should in turn be overridden by names in the class scope # (which here are called `globalns`!) if type_params: - name_to_param_map = {param.__name__: param for param in type_params} if self.__forward_is_class__: globalns, localns = dict(globalns), dict(localns) - for name, param in name_to_param_map.items(): - if name not in globalns: - globalns[name] = param - localns.pop(name, None) + for param in type_params: + param_name = param.__name__ + if param_name not in globalns: + globalns[param_name] = param + localns.pop(param_name, None) else: - localns = name_to_param_map | localns + localns = {param.__name__: param for param in type_params} | localns type_ = _type_check( eval(self.__forward_code__, globalns, localns),