Terry J. Reedy added the comment:

Thanks for the report. As Yuri pointed out in msg292701, and I verified, c.m2() 
raises "TypeError: meth() takes 0 positional arguments but 1 was given".

The purpose of get_argspec is to tell the user how to call the function without 
getting such a TypeError.  But this is not possible, at least in this case.  
When signature raises "ValueError: invalid method signature", get_argspec 
should catch ValueError and put, for instance, "Function has an invalid method 
signature" in the box, instead of a signature that does not work, so users will 
know that the function cannot be called properly.  (Should message be red?)

An initial patch could just comment out this test.  I would like to see whether 
everything else passes.  Or have you, Louie, already done that?  
Signature can raise "TypeError if that type of object is not supported".  Does 
.signature return for all the other test cases?  I expect it should  if only 
called after current guard.

    try:
        ob_call = ob.__call__
    except BaseException:
        return argspec

Before committing a patch using .signature, the known possible exception 
(ValueError) must be caught.  This test should then be changed to verify the 
new behavior.

Possible future enhancement.  Current nothing happens after code like "1(" or 
"''(".  Should a box pop up saying (in red?) something like "Non-callable 
object before ("?

----------

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

Reply via email to