Author yselivanov
Recipients larry, yselivanov
Date 2014-02-01.18:29:26
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
> Stefan Krah suggests that the failure in 20473 is because that platform builds without docstrings, and the test requires them.  So that should be an easy fix.

Good news ;) OK, I'll decorate the test.

> Because slots like tp_init and tp_call don't have docstrings.  So it has to go in the class's docstring.

So what's going on and why is it broken:

- from_builtin wasn't checking the incoming 'func' argument's type, it started to work with its '__text_signature__' right away. That was fixed.

- in 'inspect.signature' we checked 

     (isinstance(obj, _NonUserDefinedCallables) or ismethoddescriptor(obj) or
            isinstance(obj, type))

  so *classes* were tried in 'from_builtin' too.

And that's why it worked.  Any class (even used-defined in pure Python) that had '__text_signature__' was passed to the 'Signature.from_builtin' and it did the right job.

Now, I don't want to completely rollback my commits, as I still think that 'from_builtin' should strictly check what object is it working with, and raise appropriate exceptions. What we need to do is to separate parsing of '__text_signature__' into a private inspect module helper, so that 'from_builtin' becomes a tiny wrapper.  Then, in 'signature.inspect' we need to find a way of testing if the given object is a builtin class, and call the parsing helper on it if it has the '__text_signature__' attribute.

I'm looking into this.

BTW, are you sure we can't somehow add '__text_signature__' to builtin class' '__init__'?
Date User Action Args
2014-02-01 18:29:27yselivanovsetrecipients: + yselivanov, larry
2014-02-01 18:29:27yselivanovsetmessageid: <>
2014-02-01 18:29:27yselivanovlinkissue20473 messages
2014-02-01 18:29:26yselivanovcreate