Jeroen Demeyer added the comment:

> 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).

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue30071>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to