mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
Lib/typing.py copy edits originating from GH-31061 (GH-31684)
(cherry picked from commit 2031149b9a)
Co-authored-by: Matt Bogosian <eb3f73+github+com@yaymail.com>
This commit is contained in:
parent
01df048831
commit
7fba55f15a
1 changed files with 3 additions and 3 deletions
|
|
@ -285,8 +285,8 @@ def inner(*args, **kwds):
|
||||||
def _eval_type(t, globalns, localns, recursive_guard=frozenset()):
|
def _eval_type(t, globalns, localns, 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().
|
||||||
recursive_guard is used to prevent prevent infinite recursion
|
recursive_guard is used to prevent infinite recursion with a recursive
|
||||||
with recursive ForwardRef.
|
ForwardRef.
|
||||||
"""
|
"""
|
||||||
if isinstance(t, ForwardRef):
|
if isinstance(t, ForwardRef):
|
||||||
return t._evaluate(globalns, localns, recursive_guard)
|
return t._evaluate(globalns, localns, recursive_guard)
|
||||||
|
|
@ -705,7 +705,7 @@ def __mro_entries__(self, bases):
|
||||||
|
|
||||||
def __getattr__(self, attr):
|
def __getattr__(self, attr):
|
||||||
# We are careful for copy and pickle.
|
# We are careful for copy and pickle.
|
||||||
# Also for simplicity we just don't relay all dunder names
|
# Also for simplicity we don't relay any dunder names
|
||||||
if '__origin__' in self.__dict__ and not _is_dunder(attr):
|
if '__origin__' in self.__dict__ and not _is_dunder(attr):
|
||||||
return getattr(self.__origin__, attr)
|
return getattr(self.__origin__, attr)
|
||||||
raise AttributeError(attr)
|
raise AttributeError(attr)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue