[issue29602] complex() on object with __complex__ function loses sign of zero imaginary part

2017-02-19 Thread Tom Krauss
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

[issue16899] Add support for C99 complex type (_Complex) as ctypes.c_complex

2017-01-21 Thread Tom Krauss
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