Author yselivanov
Recipients benjamin.peterson, eric.araujo, larry, ncoghlan, pitrou, python-dev, scoder, terry.reedy, yselivanov
Date 2014-02-01.18:39:24
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1391279964.95.0.39325354624.issue17159@psf.upfronthosting.co.za>
In-reply-to
Content
> Would this be ok?

Probably. I need to take a closer look.

I'm not sure I like the idea that Cython functions are "chimeras" of some sort, i.e. they have a type of python builtin functions, hence, logically, Signature.from_builtin should work on them (and they have to follow __text_signature__ API), and on the other hand, they try to mimic pure python functions (being a builtin type) with all its guts like '__code__' object etc.  

Perhaps, what we need to do, is to modify 'Signature.from_builtin' to check for pure-python function duck type too, and fallback to 'Signature.from_function' in this case. Larry, Nick, what do you think?

> I would also argue that the implementation of _signature_is_builtin() is, well, not ideal, because what it should test for according to the comment at the top of the function is the existance of "__text_signature__". Instead, it does several type tests, one of which goes wrong in this case.

'from_builtin' needs to have those type checks. Duck typing is good, but some minimal type safety is good too.
History
Date User Action Args
2014-02-01 18:39:25yselivanovsetrecipients: + yselivanov, terry.reedy, ncoghlan, pitrou, scoder, larry, benjamin.peterson, eric.araujo, python-dev
2014-02-01 18:39:24yselivanovsetmessageid: <1391279964.95.0.39325354624.issue17159@psf.upfronthosting.co.za>
2014-02-01 18:39:24yselivanovlinkissue17159 messages
2014-02-01 18:39:24yselivanovcreate