mirror of
https://github.com/python/cpython.git
synced 2025-09-27 02:39:58 +00:00
gh-118418: Use a default value for type_params
in typing._eval_type
(#118431)
This commit is contained in:
parent
72dae53e09
commit
4a5ad8469a
1 changed files with 2 additions and 2 deletions
|
@ -400,7 +400,7 @@ def _tp_cache(func=None, /, *, typed=False):
|
||||||
return decorator
|
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.
|
"""Evaluate all forward references in the given type t.
|
||||||
|
|
||||||
For use of globalns and localns see the docstring for get_type_hints().
|
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_is_class__ = is_class
|
||||||
self.__forward_module__ = module
|
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:
|
if self.__forward_arg__ in recursive_guard:
|
||||||
return self
|
return self
|
||||||
if not self.__forward_evaluated__ or localns is not globalns:
|
if not self.__forward_evaluated__ or localns is not globalns:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue