New submission from Eric Fahlgren <ericfahlg...@gmail.com>:

Windows 10 Pro 64
Python 3.8.3 64
wxPython 4.1.0

It appears that there are synthetic classes in the mro, which don't appear in 
the type's namespace, raising KeyError when encountered.  From reading the 
function's doc and source, it looks like it should handle this internally and 
return a valid dict (possibly empty), and not raise KeyError.

>>> import typing, wx
>>> typing.get_type_hints(wx.Window)'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Program Files\Python38\lib\typing.py", line 1223, in get_type_hints
    base_globals = sys.modules[base.__module__].__dict__

>>> wx.Window.mro()
[<class 'wx._core.Window'>, <class 'wx._core.WindowBase'>, <class 
'wx._core.EvtHandler'>, <class 'wx._core.Object'>, <class 
'wx._core.Trackable'>, <class 'sip.wrapper'>, <class 'sip.simplewrapper'>, 
<class 'object'>]

KeyError: 'sip'

----------
components: Library (Lib)
messages: 375111
nosy: eric.fahlgren
priority: normal
severity: normal
status: open
title: typing.get_type_hints generates KeyError
versions: Python 3.8

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue41515>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to