mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
bpo-42904: Change search order of typing.get_type_hints eval (#25632)
While surprising (searching globals before locals in one specific case), this is needed for backwards compatibility.
This commit is contained in:
parent
94549ee728
commit
1b1f9852bd
3 changed files with 17 additions and 3 deletions
|
@ -3016,10 +3016,10 @@ class GetTypeHintTests(BaseTestCase):
|
|||
{'other': MySet[T], 'return': MySet[T]}
|
||||
)
|
||||
|
||||
def test_get_type_hints_classes(self):
|
||||
def test_get_type_hints_classes_str_annotations(self):
|
||||
class Foo:
|
||||
y = str
|
||||
x: y
|
||||
x: 'y'
|
||||
# This previously raised an error under PEP 563.
|
||||
self.assertEqual(get_type_hints(Foo), {'x': str})
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue