Message209907
> 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. |
|
Date |
User |
Action |
Args |
2014-02-01 18:39:25 | yselivanov | set | recipients:
+ yselivanov, terry.reedy, ncoghlan, pitrou, scoder, larry, benjamin.peterson, eric.araujo, python-dev |
2014-02-01 18:39:24 | yselivanov | set | messageid: <1391279964.95.0.39325354624.issue17159@psf.upfronthosting.co.za> |
2014-02-01 18:39:24 | yselivanov | link | issue17159 messages |
2014-02-01 18:39:24 | yselivanov | create | |
|