[New-bugs-announce] [issue38689] IDLE crashes when KeyError is raised during calltip generation

Dan Snider report at bugs.python.org
Mon Nov 4 18:45:56 EST 2019


New submission from Dan Snider <mr.assume.away at gmail.com>:

When the following program has been input (into 32 bit 3.8.0 Python running on windows 10), all IDLE processes and windows will immediately and irrevocably hang the instant the open parentheses at the end of the statement "Object(" is rendered.

However that's just my 90% sure guess of the cause, based on 
 how when the regular dict from this example is swapped with one that raises AttributeError instead of KeyError, a crash no longer occurs. Quite perplexing, seeing as neither exception is handled in get_argspec.

>>> if 1:
    from idlelib.calltip import get_argspec
    class Type(type):
        __class__ = property((__class__:={}).__getitem__,__class__.__setitem__)
    class Object(metaclass=Type):
        __slots__ = '__class__'
    get_argspec(Object)

    
Traceback (most recent call last):
  File "<pyshell#41>", line 7, in <module>
    get_argspec(Object)
  File "C:\Python38\lib\idlelib\calltip.py", line 141, in get_argspec
    argspec = str(inspect.signature(fob))
  File "C:\Python38\lib\inspect.py", line 3093, in signature
    return Signature.from_callable(obj, follow_wrapped=follow_wrapped)
  File "C:\Python38\lib\inspect.py", line 2842, in from_callable
    return _signature_from_callable(obj, sigcls=cls,
  File "C:\Python38\lib\inspect.py", line 2218, in _signature_from_callable
    if isinstance(obj, types.MethodType):
KeyError: <class '__main__.Object'>

----------
assignee: terry.reedy
components: IDLE
messages: 355983
nosy: bup, terry.reedy
priority: normal
severity: normal
status: open
title: IDLE crashes when KeyError is raised during calltip generation
versions: Python 3.8

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


More information about the New-bugs-announce mailing list