[issue38689] IDLE crashes when KeyError is raised during calltip generation

2020-04-04 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

get_argspec accesses the user object 3 times.  The first, ob.__call__ was 
already wrapped in try-except.  The second, signature(ob or ob.__call) is 
wrapped by this issue.  It also adds a new test based on Dan's example. The 
third is (ob or ob.__call__).__doc__.  I did not wrap this because I could not 
create an example for which this fails.  There seems to be some special casing 
of this special attribute so that its default is None.

I opened #40180 for the isinstance bug and #40181 for further get_argspec 
changes, in particular, removing the positional-only '/' note.

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38689] IDLE crashes when KeyError is raised during calltip generation

2020-04-03 Thread miss-islington


miss-islington  added the comment:


New changeset 15337726e5b92976c2815d05c514804e9aa49a8c by Miss Islington (bot) 
in branch '3.8':
bpo-38689: avoid IDLE hanging when calltip fails getting a signature (GH-17152)
https://github.com/python/cpython/commit/15337726e5b92976c2815d05c514804e9aa49a8c


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38689] IDLE crashes when KeyError is raised during calltip generation

2020-04-03 Thread miss-islington


miss-islington  added the comment:


New changeset 681044a0ab6c93554ff8d003c7f9fe5fdb0c83ba by Miss Islington (bot) 
in branch '3.7':
bpo-38689: avoid IDLE hanging when calltip fails getting a signature (GH-17152)
https://github.com/python/cpython/commit/681044a0ab6c93554ff8d003c7f9fe5fdb0c83ba


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38689] IDLE crashes when KeyError is raised during calltip generation

2020-04-03 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 3.0 -> 4.0
pull_requests: +18715
pull_request: https://github.com/python/cpython/pull/19353

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38689] IDLE crashes when KeyError is raised during calltip generation

2020-04-03 Thread miss-islington


Change by miss-islington :


--
pull_requests: +18716
pull_request: https://github.com/python/cpython/pull/19354

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38689] IDLE crashes when KeyError is raised during calltip generation

2020-04-03 Thread Terry J. Reedy


Terry J. Reedy  added the comment:


New changeset 52013e5b6d5ca32eef5a3d65ecdf7db89cefc2fd by Tal Einat in branch 
'master':
bpo-38689: avoid IDLE hanging when calltip fails getting a signature (GH-17152)
https://github.com/python/cpython/commit/52013e5b6d5ca32eef5a3d65ecdf7db89cefc2fd


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38689] IDLE crashes when KeyError is raised during calltip generation

2019-11-14 Thread Tal Einat


Tal Einat  added the comment:

See PR GH-17152 with a fix for the uncaught exception in getargspec().

--
nosy: +taleinat

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38689] IDLE crashes when KeyError is raised during calltip generation

2019-11-14 Thread Tal Einat


Change by Tal Einat :


--
keywords: +patch
pull_requests: +16661
stage: test needed -> patch review
pull_request: https://github.com/python/cpython/pull/17152

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38689] IDLE crashes when KeyError is raised during calltip generation

2019-11-04 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Further experiments suggest a fix for the hang, which is not specific to this 
example.  See new issue #38695.

--
stage:  -> test needed
type:  -> behavior
versions: +Python 3.7, Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38689] IDLE crashes when KeyError is raised during calltip generation

2019-11-04 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Since isinstance(Object.__call__, types.MethodType) is False, the 'fob' in 
'inspect.signature(fob)' is Object.  (See the initial get_argspec code.)  
Indeed, 'inspect.signature(Object)' results in the traceback following 
inspect.signature(fob) and 'isinstance(Object, types.MethodType)' results in 
the last line thereof.  Not returning 'False' strikes me as maybe a bug in 
'isinstance'.  Have you opened a report for this?  

Directly importing and executing  idlelib code is not supported (its is 
'private'), but entering 'Object(' to cause IDLE to make the same call is.  And 
the result is worse than the exception.  The IDLE gui process hangs, waiting 
for the response from the socket connection to the user code process that never 
comes.  This is clearly a bug, regardless of whether the user code is buggy.

The relevant section of get_argspec is

try:
argspec = str(inspect.signature(fob))
except ValueError as err:
msg = str(err)
if msg.startswith(_invalid_method):
return _invalid_method

Signature() is documented as returning either ValueError or TypeError, and with 
the 'bug' in isinstance, others are possible.  So any error should be caught.  
(The default of falling through and checking for a docstring signature is 
correct.)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38689] IDLE crashes when KeyError is raised during calltip generation

2019-11-04 Thread Dan Snider


New submission from Dan Snider :

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 "", line 7, in 
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: 

--
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 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com