diff -r d6311829da15 Objects/floatobject.c --- a/Objects/floatobject.c Tue Jan 28 05:00:08 2014 -0800 +++ b/Objects/floatobject.c Tue Jan 28 22:08:00 2014 +0800 @@ -9,6 +9,10 @@ #include #include +/*[clinic input] +class float "PyObject *" "PyFloat_Type" +[clinic start generated code]*/ +/*[clinic end generated code: checksum=da39a3ee5e6b4b0d3255bfef95601890afd80709]*/ /* Special free list free_list is a singly-linked list of available PyFloatObjects, linked @@ -775,10 +779,33 @@ return v->ob_fval != 0.0; } +/*[clinic input] +float.is_integer + +Return True if the float is an integer. +[clinic start generated code]*/ + +PyDoc_STRVAR(float_is_integer__doc__, +"is_integer(self)\n" +"Return True if the float is an integer."); + +#define FLOAT_IS_INTEGER_METHODDEF \ + {"is_integer", (PyCFunction)float_is_integer, METH_NOARGS, float_is_integer__doc__}, + static PyObject * -float_is_integer(PyObject *v) +float_is_integer_impl(PyObject *self); + +static PyObject * +float_is_integer(PyObject *self, PyObject *Py_UNUSED(ignored)) { - double x = PyFloat_AsDouble(v); + return float_is_integer_impl(self); +} + +static PyObject * +float_is_integer_impl(PyObject *self) +/*[clinic end generated code: checksum=16830d605c6bff6e11617a026f8246c273782a30]*/ +{ + double x = PyFloat_AsDouble(self); PyObject *o; if (x == -1.0 && PyErr_Occurred()) @@ -799,38 +826,130 @@ } #if 0 +/*[clinic input] +float.is_inf + +Return True if the float is positive or negative infinite. +[clinic start generated code]*/ + +PyDoc_STRVAR(float_is_inf__doc__, +"is_inf(self)\n" +"Return True if the float is positive or negative infinite."); + +#define FLOAT_IS_INF_METHODDEF \ + {"is_inf", (PyCFunction)float_is_inf, METH_NOARGS, float_is_inf__doc__}, + static PyObject * -float_is_inf(PyObject *v) +float_is_inf_impl(PyObject *self); + +static PyObject * +float_is_inf(PyObject *self, PyObject *Py_UNUSED(ignored)) { - double x = PyFloat_AsDouble(v); + return float_is_inf_impl(self); +} + +static PyObject * +float_is_inf_impl(PyObject *self) +/*[clinic end generated code: checksum=d11abdf47cbf5394bd32d3f53d00020a91707b89]*/ +{ + double x = PyFloat_AsDouble(self); if (x == -1.0 && PyErr_Occurred()) return NULL; return PyBool_FromLong((long)Py_IS_INFINITY(x)); } +/*[clinic input] +float.is_nan + +Return True if the float is not a number (NaN). +[clinic start generated code]*/ + +PyDoc_STRVAR(float_is_nan__doc__, +"is_nan(self)\n" +"Return True if the float is not a number (NaN)."); + +#define FLOAT_IS_NAN_METHODDEF \ + {"is_nan", (PyCFunction)float_is_nan, METH_NOARGS, float_is_nan__doc__}, + static PyObject * -float_is_nan(PyObject *v) +float_is_nan_impl(PyObject *self); + +static PyObject * +float_is_nan(PyObject *self, PyObject *Py_UNUSED(ignored)) { - double x = PyFloat_AsDouble(v); + return float_is_nan_impl(self); +} + +static PyObject * +float_is_nan_impl(PyObject *self) +/*[clinic end generated code: checksum=be006e61c116ae491add9d3d405ccb20db98eb4b]*/ +{ + double x = PyFloat_AsDouble(self); if (x == -1.0 && PyErr_Occurred()) return NULL; return PyBool_FromLong((long)Py_IS_NAN(x)); } +/*[clinic input] +float.is_finite + +Return True if the float is finite, neither infinite nor NaN. +[clinic start generated code]*/ + +PyDoc_STRVAR(float_is_finite__doc__, +"is_finite(self)\n" +"Return True if the float is finite, neither infinite nor NaN."); + +#define FLOAT_IS_FINITE_METHODDEF \ + {"is_finite", (PyCFunction)float_is_finite, METH_NOARGS, float_is_finite__doc__}, + static PyObject * -float_is_finite(PyObject *v) +float_is_finite_impl(PyObject *self); + +static PyObject * +float_is_finite(PyObject *self, PyObject *Py_UNUSED(ignored)) { - double x = PyFloat_AsDouble(v); + return float_is_finite_impl(self); +} + +static PyObject * +float_is_finite_impl(PyObject *self) +/*[clinic end generated code: checksum=9d403b01497d31501245b9b2b028bfcc40387d45]*/ +{ + double x = PyFloat_AsDouble(self); if (x == -1.0 && PyErr_Occurred()) return NULL; return PyBool_FromLong((long)Py_IS_FINITE(x)); } #endif +/*[clinic input] +float.__trunc__ + +Return the Integral closest to x between 0 and x. +[clinic start generated code]*/ + +PyDoc_STRVAR(float___trunc____doc__, +"__trunc__(self)\n" +"Return the Integral closest to x between 0 and x."); + +#define FLOAT___TRUNC___METHODDEF \ + {"__trunc__", (PyCFunction)float___trunc__, METH_NOARGS, float___trunc____doc__}, + static PyObject * -float_trunc(PyObject *v) +float___trunc___impl(PyObject *self); + +static PyObject * +float___trunc__(PyObject *self, PyObject *Py_UNUSED(ignored)) { - double x = PyFloat_AsDouble(v); + return float___trunc___impl(self); +} + +static PyObject * +float___trunc___impl(PyObject *self) +/*[clinic end generated code: checksum=cda4568b09eb80ef6c2bb137d4124a96cde74be5]*/ +{ + double x = PyFloat_AsDouble(self); double wholepart; /* integral portion of x, rounded toward 0 */ (void)modf(x, &wholepart); @@ -1015,14 +1134,37 @@ #undef NDIGITS_MIN } +/*[clinic input] +float.conjugate + +Return self, the complex conjugate of any float. +[clinic start generated code]*/ + +PyDoc_STRVAR(float_conjugate__doc__, +"conjugate(self)\n" +"Return self, the complex conjugate of any float."); + +#define FLOAT_CONJUGATE_METHODDEF \ + {"conjugate", (PyCFunction)float_conjugate, METH_NOARGS, float_conjugate__doc__}, + static PyObject * -float_float(PyObject *v) +float_conjugate_impl(PyObject *self); + +static PyObject * +float_conjugate(PyObject *self, PyObject *Py_UNUSED(ignored)) { - if (PyFloat_CheckExact(v)) - Py_INCREF(v); + return float_conjugate_impl(self); +} + +static PyObject * +float_conjugate_impl(PyObject *self) +/*[clinic end generated code: checksum=1308689870d6ab2d20a0ee7c2cfe993322866f95]*/ +{ + if (PyFloat_CheckExact(self)) + Py_INCREF(self); else - v = PyFloat_FromDouble(((PyFloatObject *)v)->ob_fval); - return v; + self = PyFloat_FromDouble(((PyFloatObject *)self)->ob_fval); + return self; } /* turn ASCII hex characters into integer values and vice versa */ @@ -1105,8 +1247,41 @@ of the form 4k+1. */ #define TOHEX_NBITS DBL_MANT_DIG + 3 - (DBL_MANT_DIG+2)%4 +/*[clinic input] +float.hex + +Return a hexadecimal representation of a floating-point number. + +>>> (-0.1).hex() +'-0x1.999999999999ap-4' +>>> 3.14159.hex() +'0x1.921f9f01b866ep+1' +[clinic start generated code]*/ + +PyDoc_STRVAR(float_hex__doc__, +"hex(self)\n" +"Return a hexadecimal representation of a floating-point number.\n" +"\n" +">>> (-0.1).hex()\n" +"\'-0x1.999999999999ap-4\'\n" +">>> 3.14159.hex()\n" +"\'0x1.921f9f01b866ep+1\'"); + +#define FLOAT_HEX_METHODDEF \ + {"hex", (PyCFunction)float_hex, METH_NOARGS, float_hex__doc__}, + static PyObject * -float_hex(PyObject *v) +float_hex_impl(PyObject *self); + +static PyObject * +float_hex(PyObject *self, PyObject *Py_UNUSED(ignored)) +{ + return float_hex_impl(self); +} + +static PyObject * +float_hex_impl(PyObject *self) +/*[clinic end generated code: checksum=951f670c33f8b35d129b988f00ff9dbaa2d67582]*/ { double x, m; int e, shift, i, si, esign; @@ -1114,10 +1289,10 @@ trailing NUL byte. */ char s[(TOHEX_NBITS-1)/4+3]; - CONVERT_TO_DOUBLE(v, x); + CONVERT_TO_DOUBLE(self, x); if (Py_IS_NAN(x) || Py_IS_INFINITY(x)) - return float_repr((PyFloatObject *)v); + return float_repr((PyFloatObject *)self); if (x == 0.0) { if (copysign(1.0, x) == -1.0) @@ -1158,19 +1333,39 @@ return PyUnicode_FromFormat("0x%sp%c%d", s, esign, e); } -PyDoc_STRVAR(float_hex_doc, -"float.hex() -> string\n\ -\n\ -Return a hexadecimal representation of a floating-point number.\n\ ->>> (-0.1).hex()\n\ -'-0x1.999999999999ap-4'\n\ ->>> 3.14159.hex()\n\ -'0x1.921f9f01b866ep+1'"); - /* Convert a hexadecimal string to a float. */ +/*[clinic input] +@classmethod +float.fromhex + + self: self(type="PyObject *") + string: object + / + +Create a floating-point number from a hexadecimal string. + +>>> float.fromhex('0x1.ffffp10') +2047.984375 +>>> float.fromhex('-0x1p-1074') +-5e-324 +[clinic start generated code]*/ + +PyDoc_STRVAR(float_fromhex__doc__, +"fromhex(type, string)\n" +"Create a floating-point number from a hexadecimal string.\n" +"\n" +">>> float.fromhex(\'0x1.ffffp10\')\n" +"2047.984375\n" +">>> float.fromhex(\'-0x1p-1074\')\n" +"-5e-324"); + +#define FLOAT_FROMHEX_METHODDEF \ + {"fromhex", (PyCFunction)float_fromhex, METH_O|METH_CLASS, float_fromhex__doc__}, + static PyObject * -float_fromhex(PyObject *cls, PyObject *arg) +float_fromhex(PyObject *self, PyObject *string) +/*[clinic end generated code: checksum=a02cc61d6c4a4025361da8c08515ad9669c8b3e1]*/ { PyObject *result_as_float, *result; double x; @@ -1224,7 +1419,7 @@ * exp+4*ndigits and exp-4*ndigits are within the range of a long. */ - s = _PyUnicode_AsStringAndSize(arg, &length); + s = _PyUnicode_AsStringAndSize(string, &length); if (s == NULL) return NULL; s_end = s + length; @@ -1390,7 +1585,7 @@ result_as_float = Py_BuildValue("(d)", negate ? -x : x); if (result_as_float == NULL) return NULL; - result = PyObject_CallObject(cls, result_as_float); + result = PyObject_CallObject(self, result_as_float); Py_DECREF(result_as_float); return result; @@ -1410,20 +1605,57 @@ return NULL; } -PyDoc_STRVAR(float_fromhex_doc, -"float.fromhex(string) -> float\n\ -\n\ -Create a floating-point number from a hexadecimal string.\n\ ->>> float.fromhex('0x1.ffffp10')\n\ -2047.984375\n\ ->>> float.fromhex('-0x1p-1074')\n\ --5e-324"); +/*[clinic input] +float.as_integer_ratio +Return integer ratio. + +Return a pair of integers, whose ratio is exactly equal to the original float +and with a positive denominator. + +Raise OverflowError on infinities and a ValueError on NaNs. + +>>> (10.0).as_integer_ratio() +(10, 1) +>>> (0.0).as_integer_ratio() +(0, 1) +>>> (-.25).as_integer_ratio() +(-1, 4) +[clinic start generated code]*/ + +PyDoc_STRVAR(float_as_integer_ratio__doc__, +"as_integer_ratio(self)\n" +"Return integer ratio.\n" +"\n" +"Return a pair of integers, whose ratio is exactly equal to the original float\n" +"and with a positive denominator.\n" +"\n" +"Raise OverflowError on infinities and a ValueError on NaNs.\n" +"\n" +">>> (10.0).as_integer_ratio()\n" +"(10, 1)\n" +">>> (0.0).as_integer_ratio()\n" +"(0, 1)\n" +">>> (-.25).as_integer_ratio()\n" +"(-1, 4)"); + +#define FLOAT_AS_INTEGER_RATIO_METHODDEF \ + {"as_integer_ratio", (PyCFunction)float_as_integer_ratio, METH_NOARGS, float_as_integer_ratio__doc__}, static PyObject * -float_as_integer_ratio(PyObject *v, PyObject *unused) +float_as_integer_ratio_impl(PyObject *self); + +static PyObject * +float_as_integer_ratio(PyObject *self, PyObject *Py_UNUSED(ignored)) { - double self; + return float_as_integer_ratio_impl(self); +} + +static PyObject * +float_as_integer_ratio_impl(PyObject *self) +/*[clinic end generated code: checksum=2947bbdc0c16c65324d8ecf93394c7c5e9fd1b54]*/ +{ + double self_double; double float_part; int exponent; int i; @@ -1440,21 +1672,21 @@ obj = call; \ Py_DECREF(prev); \ - CONVERT_TO_DOUBLE(v, self); + CONVERT_TO_DOUBLE(self, self_double); - if (Py_IS_INFINITY(self)) { + if (Py_IS_INFINITY(self_double)) { PyErr_SetString(PyExc_OverflowError, "Cannot pass infinity to float.as_integer_ratio."); return NULL; } - if (Py_IS_NAN(self)) { + if (Py_IS_NAN(self_double)) { PyErr_SetString(PyExc_ValueError, "Cannot pass NaN to float.as_integer_ratio."); return NULL; } PyFPE_START_PROTECT("as_integer_ratio", goto error); - float_part = frexp(self, &exponent); /* self == float_part * 2**exponent exactly */ + float_part = frexp(self_double, &exponent); /* self_double == float_part * 2**exponent exactly */ PyFPE_END_PROTECT(float_part); for (i=0; i<300 && float_part != floor(float_part) ; i++) { @@ -1496,21 +1728,6 @@ return result_pair; } -PyDoc_STRVAR(float_as_integer_ratio_doc, -"float.as_integer_ratio() -> (int, int)\n" -"\n" -"Return a pair of integers, whose ratio is exactly equal to the original\n" -"float and with a positive denominator.\n" -"Raise OverflowError on infinities and a ValueError on NaNs.\n" -"\n" -">>> (10.0).as_integer_ratio()\n" -"(10, 1)\n" -">>> (0.0).as_integer_ratio()\n" -"(0, 1)\n" -">>> (-.25).as_integer_ratio()\n" -"(-1, 4)"); - - static PyObject * float_subtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds); @@ -1571,19 +1788,49 @@ static float_format_type double_format, float_format; static float_format_type detected_double_format, detected_float_format; +/*[clinic input] +@classmethod +float.__getformat__ + + typestr: object + / + +You probably don't want to use this function. + +It exists mainly to be used in Python's test suite. + +typestr must be 'double' or 'float'. This function returns whichever of +'unknown', 'IEEE, big-endian' or 'IEEE, little-endian' best describes the +format of floating point numbers used by the C type named by typestr. +[clinic start generated code]*/ + +PyDoc_STRVAR(float___getformat____doc__, +"__getformat__(type, typestr)\n" +"You probably don\'t want to use this function.\n" +"\n" +"It exists mainly to be used in Python\'s test suite.\n" +"\n" +"typestr must be \'double\' or \'float\'. This function returns whichever of\n" +"\'unknown\', \'IEEE, big-endian\' or \'IEEE, little-endian\' best describes the\n" +"format of floating point numbers used by the C type named by typestr."); + +#define FLOAT___GETFORMAT___METHODDEF \ + {"__getformat__", (PyCFunction)float___getformat__, METH_O|METH_CLASS, float___getformat____doc__}, + static PyObject * -float_getformat(PyTypeObject *v, PyObject* arg) +float___getformat__(PyTypeObject *type, PyObject *typestr) +/*[clinic end generated code: checksum=d32d58fc12fee6cfa840ed122409545cfdc51347]*/ { char* s; float_format_type r; - if (!PyUnicode_Check(arg)) { + if (!PyUnicode_Check(typestr)) { PyErr_Format(PyExc_TypeError, "__getformat__() argument must be string, not %.500s", - Py_TYPE(arg)->tp_name); + Py_TYPE(typestr)->tp_name); return NULL; } - s = _PyUnicode_AsString(arg); + s = _PyUnicode_AsString(typestr); if (s == NULL) return NULL; if (strcmp(s, "double") == 0) { @@ -1612,28 +1859,69 @@ } } -PyDoc_STRVAR(float_getformat_doc, -"float.__getformat__(typestr) -> string\n" +/*[clinic input] +float.__set_format__ + + typestr: str + fmt: str + / + +You probably don't want to use this function. + +It exists mainly to be used in Python's test suite. + +typestr must be 'double' or 'float'. fmt must be one of 'unknown', +'IEEE, big-endian' or 'IEEE, little-endian', and in addition can only be +one of the latter two if it appears to match the underlying C reality. + +Override the automatic determination of C-level floating point type. +This affects how floats are converted to and from binary strings. +[clinic start generated code]*/ + +PyDoc_STRVAR(float___set_format____doc__, +"__set_format__(self, typestr, fmt)\n" +"You probably don\'t want to use this function.\n" "\n" -"You probably don't want to use this function. It exists mainly to be\n" -"used in Python's test suite.\n" +"It exists mainly to be used in Python\'s test suite.\n" "\n" -"typestr must be 'double' or 'float'. This function returns whichever of\n" -"'unknown', 'IEEE, big-endian' or 'IEEE, little-endian' best describes the\n" -"format of floating point numbers used by the C type named by typestr."); +"typestr must be \'double\' or \'float\'. fmt must be one of \'unknown\',\n" +"\'IEEE, big-endian\' or \'IEEE, little-endian\', and in addition can only be\n" +"one of the latter two if it appears to match the underlying C reality.\n" +"\n" +"Override the automatic determination of C-level floating point type.\n" +"This affects how floats are converted to and from binary strings."); + +#define FLOAT___SET_FORMAT___METHODDEF \ + {"__set_format__", (PyCFunction)float___set_format__, METH_VARARGS, float___set_format____doc__}, static PyObject * -float_setformat(PyTypeObject *v, PyObject* args) +float___set_format___impl(PyObject *self, const char *typestr, const char *fmt); + +static PyObject * +float___set_format__(PyObject *self, PyObject *args) { - char* typestr; - char* format; + PyObject *return_value = NULL; + const char *typestr; + const char *fmt; + + if (!PyArg_ParseTuple(args, + "ss:__set_format__", + &typestr, &fmt)) + goto exit; + return_value = float___set_format___impl(self, typestr, fmt); + +exit: + return return_value; +} + +static PyObject * +float___set_format___impl(PyObject *self, const char *typestr, const char *fmt) +/*[clinic end generated code: checksum=a10f553b626354ee3f10db20c563602cbe6ff899]*/ +{ float_format_type f; float_format_type detected; float_format_type *p; - if (!PyArg_ParseTuple(args, "ss:__setformat__", &typestr, &format)) - return NULL; - if (strcmp(typestr, "double") == 0) { p = &double_format; detected = detected_double_format; @@ -1649,13 +1937,13 @@ return NULL; } - if (strcmp(format, "unknown") == 0) { + if (strcmp(fmt, "unknown") == 0) { f = unknown_format; } - else if (strcmp(format, "IEEE, little-endian") == 0) { + else if (strcmp(fmt, "IEEE, little-endian") == 0) { f = ieee_little_endian_format; } - else if (strcmp(format, "IEEE, big-endian") == 0) { + else if (strcmp(fmt, "IEEE, big-endian") == 0) { f = ieee_big_endian_format; } else { @@ -1678,35 +1966,54 @@ Py_RETURN_NONE; } -PyDoc_STRVAR(float_setformat_doc, -"float.__setformat__(typestr, fmt) -> None\n" -"\n" -"You probably don't want to use this function. It exists mainly to be\n" -"used in Python's test suite.\n" -"\n" -"typestr must be 'double' or 'float'. fmt must be one of 'unknown',\n" -"'IEEE, big-endian' or 'IEEE, little-endian', and in addition can only be\n" -"one of the latter two if it appears to match the underlying C reality.\n" -"\n" -"Override the automatic determination of C-level floating point type.\n" -"This affects how floats are converted to and from binary strings."); - static PyObject * float_getzero(PyObject *v, void *closure) { return PyFloat_FromDouble(0.0); } +/*[clinic input] +float.__format__ + + format_spec: unicode + / + +Formats the float according to format_spec. +[clinic start generated code]*/ + +PyDoc_STRVAR(float___format____doc__, +"__format__(self, format_spec)\n" +"Formats the float according to format_spec."); + +#define FLOAT___FORMAT___METHODDEF \ + {"__format__", (PyCFunction)float___format__, METH_VARARGS, float___format____doc__}, + static PyObject * -float__format__(PyObject *self, PyObject *args) +float___format___impl(PyObject *self, PyObject *format_spec); + +static PyObject * +float___format__(PyObject *self, PyObject *args) { + PyObject *return_value = NULL; PyObject *format_spec; + + if (!PyArg_ParseTuple(args, + "U:__format__", + &format_spec)) + goto exit; + return_value = float___format___impl(self, format_spec); + +exit: + return return_value; +} + +static PyObject * +float___format___impl(PyObject *self, PyObject *format_spec) +/*[clinic end generated code: checksum=bdaa7ee65e29ddaac99d47b792a3bad1954af820]*/ +{ _PyUnicodeWriter writer; int ret; - if (!PyArg_ParseTuple(args, "U:__format__", &format_spec)) - return NULL; - _PyUnicodeWriter_Init(&writer); ret = _PyFloat_FormatAdvancedWriter( &writer, @@ -1719,49 +2026,31 @@ return _PyUnicodeWriter_Finish(&writer); } -PyDoc_STRVAR(float__format__doc, -"float.__format__(format_spec) -> string\n" -"\n" -"Formats the float according to format_spec."); - - static PyMethodDef float_methods[] = { - {"conjugate", (PyCFunction)float_float, METH_NOARGS, - "Return self, the complex conjugate of any float."}, - {"__trunc__", (PyCFunction)float_trunc, METH_NOARGS, - "Return the Integral closest to x between 0 and x."}, + FLOAT_CONJUGATE_METHODDEF + FLOAT___TRUNC___METHODDEF {"__round__", (PyCFunction)float_round, METH_VARARGS, "Return the Integral closest to x, rounding half toward even.\n" "When an argument is passed, work like built-in round(x, ndigits)."}, - {"as_integer_ratio", (PyCFunction)float_as_integer_ratio, METH_NOARGS, - float_as_integer_ratio_doc}, - {"fromhex", (PyCFunction)float_fromhex, - METH_O|METH_CLASS, float_fromhex_doc}, - {"hex", (PyCFunction)float_hex, - METH_NOARGS, float_hex_doc}, - {"is_integer", (PyCFunction)float_is_integer, METH_NOARGS, - "Return True if the float is an integer."}, + FLOAT_AS_INTEGER_RATIO_METHODDEF + FLOAT_FROMHEX_METHODDEF + FLOAT_HEX_METHODDEF + FLOAT_IS_INTEGER_METHODDEF #if 0 - {"is_inf", (PyCFunction)float_is_inf, METH_NOARGS, - "Return True if the float is positive or negative infinite."}, - {"is_finite", (PyCFunction)float_is_finite, METH_NOARGS, - "Return True if the float is finite, neither infinite nor NaN."}, - {"is_nan", (PyCFunction)float_is_nan, METH_NOARGS, - "Return True if the float is not a number (NaN)."}, + FLOAT_IS_INF_METHODDEF + FLOAT_IS_FINITE_METHODDEF + FLOAT_IS_NAN_METHODDEF #endif {"__getnewargs__", (PyCFunction)float_getnewargs, METH_NOARGS}, - {"__getformat__", (PyCFunction)float_getformat, - METH_O|METH_CLASS, float_getformat_doc}, - {"__setformat__", (PyCFunction)float_setformat, - METH_VARARGS|METH_CLASS, float_setformat_doc}, - {"__format__", (PyCFunction)float__format__, - METH_VARARGS, float__format__doc}, + FLOAT___GETFORMAT___METHODDEF + FLOAT___SET_FORMAT___METHODDEF + FLOAT___FORMAT___METHODDEF {NULL, NULL} /* sentinel */ }; static PyGetSetDef float_getset[] = { {"real", - (getter)float_float, (setter)NULL, + (getter)float_conjugate_impl, (setter)NULL, "the real part of a complex number", NULL}, {"imag", @@ -1785,7 +2074,7 @@ float_divmod, /*nb_divmod*/ float_pow, /*nb_power*/ (unaryfunc)float_neg, /*nb_negative*/ - (unaryfunc)float_float, /*nb_positive*/ + (unaryfunc)float_conjugate_impl, /*nb_positive*/ (unaryfunc)float_abs, /*nb_absolute*/ (inquiry)float_bool, /*nb_bool*/ 0, /*nb_invert*/ @@ -1794,9 +2083,9 @@ 0, /*nb_and*/ 0, /*nb_xor*/ 0, /*nb_or*/ - float_trunc, /*nb_int*/ + float___trunc___impl, /*nb_int*/ 0, /*nb_reserved*/ - float_float, /*nb_float*/ + float_conjugate_impl, /*nb_float*/ 0, /* nb_inplace_add */ 0, /* nb_inplace_subtract */ 0, /* nb_inplace_multiply */