[Python-Dev] return type of __complex__

Christian Heimes christian at python.org
Fri Oct 19 18:31:31 CEST 2012


Am 19.10.2012 18:23, schrieb Maciej Fijalkowski:
> Nick just said it's a bug that cmath type checks are too strict.

I'm not so sure about that. cmath just uses PyArg_ParseTuple with "D"
which itself relies upon PyComplex_AsCComplex().

D (complex) [Py_complex]
    Convert a Python complex number to a C Py_complex structure.

In order to fix the bug the code in PyComplex_AsCComplex() must be
altered to support float as return type from __complex__(). That's a
major change.

Christian


More information about the Python-Dev mailing list