Message356008
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.) |
|
Date |
User |
Action |
Args |
2019-11-05 07:23:24 | terry.reedy | set | recipients:
+ terry.reedy, bup |
2019-11-05 07:23:24 | terry.reedy | set | messageid: <1572938604.85.0.675598153566.issue38689@roundup.psfhosted.org> |
2019-11-05 07:23:24 | terry.reedy | link | issue38689 messages |
2019-11-05 07:23:24 | terry.reedy | create | |
|