[issue39990] help should evaluate forward reference

Nguyễn Gia Phong report at bugs.python.org
Tue Mar 17 10:19:09 EDT 2020


Nguyễn Gia Phong <mcsinyx at disroot.org> added the comment:

I traced it down to inspect.formatannotation(annotation).  Before checking for isinstance(annotation, type), IMHO we should do something like

import typing

if isinstance(annotation, str):
    annotation = typing.ForwardRef(str)._evaluate(annotation)

However, is is not aware of globals and especially locals of help caller, so I guess more sophisticated solution is required.

----------
title: help output should make use of typing.get_type_hints -> help should evaluate forward reference

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39990>
_______________________________________


More information about the Python-bugs-list mailing list