Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork34.1k
Closed
Description
Bug report
Bug description:
Tested on 3.14.0a1 - related to implementation of PEP 649 / PEP 749 -#119180
If a type uses dotted access but can't be evaluated,get_annotations returns_Stringifier objects instead ofForwardRef objects.
fromannotationlibimportget_annotations,FormatclassExample:dotted:typing.Anyundotted:Anyann=get_annotations(Example,format=Format.FORWARDREF)forname,valueinann.items():print(f"{name!r}:{value!r} | type:{type(value)!r}")
Output:
'dotted': typing.Any | type: <class 'annotationlib._Stringifier'>'undotted': ForwardRef('Any') | type: <class 'annotationlib.ForwardRef'>I'd expect to seeForwardRef('typing.Any') here so this was surprising. I also found another bug related to dotted access but not related to Stringifiers that I'll raise separately.
CPython versions tested on:
3.14
Operating systems tested on:
Linux