This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author yselivanov
Recipients larry, ncoghlan, yselivanov
Date 2014-02-02.02:21:21
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1391307683.93.0.363103451945.issue20473@psf.upfronthosting.co.za>
In-reply-to
Content
Please review the attached patch (sig_builtins_01.patch).

Some details:

- All parsing code from Signature.from_builtin was moved
in a separate helper '_signature_fromstr'

- Signature.from_builtin calls '_signature_fromstr'. All
its validation logic is untouched.

- 'inspect.signature' was tweaked a bit: when it's certain
that the object is a class and there is no user-defined
__init__ or __new__ or its meta's __call__, it traverses
the MRO to find non-empty __text_signature__. If it finds
one -- it returns with _signature_fromstr(). If not, it checks
if __init__ is type.__init__ or object.__init__. The last
check is a bit tricky -- the only way of doing that check
(I think) is to use __qualname__.

Since the patch is non-trivial, any review/comments would
be greatly appreciated.
History
Date User Action Args
2014-02-02 02:21:23yselivanovsetrecipients: + yselivanov, ncoghlan, larry
2014-02-02 02:21:23yselivanovsetmessageid: <1391307683.93.0.363103451945.issue20473@psf.upfronthosting.co.za>
2014-02-02 02:21:23yselivanovlinkissue20473 messages
2014-02-02 02:21:23yselivanovcreate