Author terry.reedy
Recipients louielu, terry.reedy, yselivanov
Date 2017-05-02.02:56:53
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1493693814.41.0.902540150172.issue19903@psf.upfronthosting.co.za>
In-reply-to
Content
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 ("?
History
Date User Action Args
2017-05-02 02:56:54terry.reedysetrecipients: + terry.reedy, yselivanov, louielu
2017-05-02 02:56:54terry.reedysetmessageid: <1493693814.41.0.902540150172.issue19903@psf.upfronthosting.co.za>
2017-05-02 02:56:54terry.reedylinkissue19903 messages
2017-05-02 02:56:53terry.reedycreate