Skip to content

Commit ef6baca

Browse files
authored
Update ForwardRef._evaluate for Python 3.11 (#8600)
recursive_guard argument was added in python/cpython#21553
1 parent fed419b commit ef6baca

File tree

4 files changed

+7
-4
lines changed

4 files changed

+7
-4
lines changed

stdlib/typing.pyi

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -820,7 +820,13 @@ class ForwardRef:
820820
else:
821821
def __init__(self, arg: str, is_argument: bool = ...) -> None: ...
822822

823-
def _evaluate(self, globalns: dict[str, Any] | None, localns: dict[str, Any] | None) -> Any | None: ...
823+
if sys.version_info >= (3, 9):
824+
def _evaluate(
825+
self, globalns: dict[str, Any] | None, localns: dict[str, Any] | None, recursive_guard: frozenset[str]
826+
) -> Any | None: ...
827+
else:
828+
def _evaluate(self, globalns: dict[str, Any] | None, localns: dict[str, Any] | None) -> Any | None: ...
829+
824830
def __eq__(self, other: object) -> bool: ...
825831
if sys.version_info >= (3, 11):
826832
def __or__(self, other: Any) -> _SpecialForm: ...

tests/stubtest_allowlists/py310.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ types.GenericAlias.__getattr__
3636
types.GenericAlias.__mro_entries__
3737
types.GenericAlias.__call__ # Would be complicated to fix properly, Any could silence problems. #6392
3838
typing._SpecialForm.__mro_entries__
39-
typing.ForwardRef._evaluate
4039
typing._TypedDict.__delitem__
4140
typing._TypedDict.__ior__
4241
typing._TypedDict.__or__

tests/stubtest_allowlists/py311.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ platform.uname_result.processor
4242
queue.SimpleQueue.__init__
4343
sys.UnraisableHookArgs # Not exported from sys
4444
tkinter._VersionInfoType.__doc__
45-
typing.ForwardRef._evaluate
4645
typing.NewType.__call__
4746
typing.NewType.__mro_entries__
4847
weakref.WeakValueDictionary.update

tests/stubtest_allowlists/py39.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ tkinter.Tk.split
5555
types.CodeType.replace # stubtest thinks default values are None but None doesn't work at runtime
5656
types.GenericAlias.__getattr__
5757
types.GenericAlias.__call__ # Would be complicated to fix properly, Any could silence problems. #6392
58-
typing.ForwardRef._evaluate
5958
typing.SupportsAbs.__init__
6059
typing.SupportsBytes.__init__
6160
typing.SupportsComplex.__init__

0 commit comments

Comments
 (0)