New submission from Tom Krauss:
Consider the following simple class that provides a "__complex__" method.
class C(object):
def __init__(self, x):
self.x = x
def __complex__(self):
return self.x
x=C(-0j)
PYTHON 2.7.13
>>> x.x
-0j
>>> complex(x)
0
Tom Krauss added the comment:
I'm trying to add support for this in cffi, which uses ctypes... apparently
this is now supported in libffi (https://github.com/libffi/libffi, v3.2 Nov
2014).
It would be nice if this issue could be re-opened, or another one created for
the same purpose