]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-118418: Use a default value for `type_params` in `typing._eval_type` (#118431)
authorNikita Sobolev <mail@sobolevn.me>
Tue, 30 Apr 2024 15:44:37 +0000 (18:44 +0300)
committerGitHub <noreply@github.com>
Tue, 30 Apr 2024 15:44:37 +0000 (15:44 +0000)
Lib/typing.py

index b3f4ba99f9ec2197491218d6b47f2c6a76fbb975..eff65cfb68b8666d8be98ac72772960ee9ce02f1 100644 (file)
@@ -400,7 +400,7 @@ def _tp_cache(func=None, /, *, typed=False):
     return decorator
 
 
-def _eval_type(t, globalns, localns, type_params, *, recursive_guard=frozenset()):
+def _eval_type(t, globalns, localns, type_params=None, *, recursive_guard=frozenset()):
     """Evaluate all forward references in the given type t.
 
     For use of globalns and localns see the docstring for get_type_hints().
@@ -981,7 +981,7 @@ class ForwardRef(_Final, _root=True):
         self.__forward_is_class__ = is_class
         self.__forward_module__ = module
 
-    def _evaluate(self, globalns, localns, type_params, *, recursive_guard):
+    def _evaluate(self, globalns, localns, type_params=None, *, recursive_guard):
         if self.__forward_arg__ in recursive_guard:
             return self
         if not self.__forward_evaluated__ or localns is not globalns: