[issue39866] get_type_hints raises inconsistent TypeError

2020-03-05 Thread Guido van Rossum
Guido van Rossum added the comment: It should definitely not return {} for objects without __annotations__ attributes -- get_type_hints(42) should raise TypeError. One could argue that get_type_hints(Bar()) incorrectly returns a dict, but we want to allow for some duck typing here, and,

[issue39866] get_type_hints raises inconsistent TypeError

2020-03-05 Thread Karthikeyan Singaravelan
Change by Karthikeyan Singaravelan : -- nosy: +gvanrossum, levkivskyi ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue39866] get_type_hints raises inconsistent TypeError

2020-03-05 Thread Joey
New submission from Joey : If you pass in an instance of an object without type annotations, you get an error that states "XXX is not a module, class, method, or function." This correctly describes the situation  typing.get_type_hints(object()) Traceback (most recent call last): File "",