diff options
author | Mark Dickinson <mdickinson@enthought.com> | 2021-08-23 08:15:49 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-23 08:15:49 (GMT) |
commit | 6082bb5addab93755ab6e2bd2ed6021b391e10d1 (patch) | |
tree | ef109d492632072d919a7ebeb2ce89342a2babdb /Objects/clinic | |
parent | eec340ea3af27887fcaac4029ebdee99f3713bff (diff) | |
download | cpython-6082bb5addab93755ab6e2bd2ed6021b391e10d1.zip cpython-6082bb5addab93755ab6e2bd2ed6021b391e10d1.tar.gz cpython-6082bb5addab93755ab6e2bd2ed6021b391e10d1.tar.bz2 |
bpo-24234: implement complex.__complex__ (GH-27887)
Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
Diffstat (limited to 'Objects/clinic')
-rw-r--r-- | Objects/clinic/complexobject.c.h | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/Objects/clinic/complexobject.c.h b/Objects/clinic/complexobject.c.h index 557fbf9..e7d8065 100644 --- a/Objects/clinic/complexobject.c.h +++ b/Objects/clinic/complexobject.c.h @@ -69,6 +69,24 @@ exit: return return_value; } +PyDoc_STRVAR(complex___complex____doc__, +"__complex__($self, /)\n" +"--\n" +"\n" +"Convert this value to exact type complex."); + +#define COMPLEX___COMPLEX___METHODDEF \ + {"__complex__", (PyCFunction)complex___complex__, METH_NOARGS, complex___complex____doc__}, + +static PyObject * +complex___complex___impl(PyComplexObject *self); + +static PyObject * +complex___complex__(PyComplexObject *self, PyObject *Py_UNUSED(ignored)) +{ + return complex___complex___impl(self); +} + PyDoc_STRVAR(complex_new__doc__, "complex(real=0, imag=0)\n" "--\n" @@ -113,4 +131,4 @@ skip_optional_pos: exit: return return_value; } -/*[clinic end generated code: output=056cac3226d94967 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=6d85094ace15677e input=a9049054013a1b77]*/ |