Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Lib/test/test_annotationlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,13 @@ def f(x: 'int') -> 'str': ...
result = get_annotations(f, eval_str=True)
self.assertEqual(result, {'x': int, 'return': str})

def test_eval_str_wrapped_partial_cycle_self(self):
def f(x: 'int') -> 'str': ...
f.__wrapped__ = functools.partial(f, 0)
# Cycle is detected and broken; globals from f itself are used.
result = get_annotations(f, eval_str=True)
self.assertEqual(result, {'x': int, 'return': str})

def test_eval_str_wrapped_cycle_mutual(self):
# gh-146556: mutual __wrapped__ cycle (a -> b -> a) must not hang.
def a(x: 'int'): ...
Expand Down
Loading