Bug report
Bug description:
If a ForwardRef object needs internal names to store values of known objects these internal names currently replace the type_repr of the objects they represent when the ForwardRef is evaluated as Format.STRING or when looking at the repr.
If it was just the repr I'd probably put this as a feature request but as it makes the STRING format arguably 'wrong' I think it should be considered a bug.
fromannotationlibimportget_annotations, FormatclassExample:
a: ref|strann=get_annotations(Example, format=Format.FORWARDREF)['a']
print(ann)
print(ann.evaluate(format=Format.STRING))
On 3.14 or Main:
ForwardRef('ref | __annotationlib_name_1__', is_class=True, owner=<class'__main__.Example'>)
ref|__annotationlib_name_1__Expected:
ForwardRef('ref | str', is_class=True, owner=<class'__main__.Example'>)
ref|strCPython versions tested on:
3.14, CPython main branch
Operating systems tested on:
No response
Linked PRs
Bug report
Bug description:
If a
ForwardRefobject needs internal names to store values of known objects these internal names currently replace thetype_reprof the objects they represent when the ForwardRef is evaluated asFormat.STRINGor when looking at the repr.If it was just the repr I'd probably put this as a feature request but as it makes the
STRINGformat arguably 'wrong' I think it should be considered a bug.On 3.14 or Main:
Expected:
CPython versions tested on:
3.14, CPython main branch
Operating systems tested on:
No response
Linked PRs