Author jdemeyer
Recipients jdemeyer, r.david.murray, scoder, serhiy.storchaka, steven.daprano, terry.reedy
Date 2017-04-15.15:06:26
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1492268786.85.0.904799903552.issue30071@psf.upfronthosting.co.za>
In-reply-to
Content
> As indicated above, perfect emulation seems impossible for Cython or any other external compiler that does not use the same bytecode.

True, Cython functions are not implemented using Python bytecode, so perfect emulation is impossible. The use case I care most about is getargspec(), which is fully supported by Cython functions.

> If it were possible for Cython to makes its CythonFunction class a subclass of FunctionType, the issue would be 'solved', though the incompatibilities would remain.

That's an interesting idea. Currently, that is simply impossible because

>>> from types import FunctionType
>>> class X(FunctionType): pass
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: type 'function' is not an acceptable base type

Still, one could argue to change the implementation of FunctionType. If you do that, it would be best to define a BaseFunctionType and then have Cython functions and Python functions inherit from that. Personally, I think that's an even better but much more involved solution (I guess it would require a PEP).
History
Date User Action Args
2017-04-15 15:06:26jdemeyersetrecipients: + jdemeyer, terry.reedy, scoder, steven.daprano, r.david.murray, serhiy.storchaka
2017-04-15 15:06:26jdemeyersetmessageid: <1492268786.85.0.904799903552.issue30071@psf.upfronthosting.co.za>
2017-04-15 15:06:26jdemeyerlinkissue30071 messages
2017-04-15 15:06:26jdemeyercreate