mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
bpo-41974: Remove complex.__float__, complex.__floordiv__, etc (GH-22593)
Remove complex special methods __int__, __float__, __floordiv__, __mod__, __divmod__, __rfloordiv__, __rmod__ and __rdivmod__ which always raised a TypeError.
This commit is contained in:
parent
48f305fd12
commit
e2ec0b27c0
8 changed files with 81 additions and 66 deletions
|
@ -747,10 +747,10 @@ done:
|
|||
int
|
||||
PyNumber_Check(PyObject *o)
|
||||
{
|
||||
return o && Py_TYPE(o)->tp_as_number &&
|
||||
(Py_TYPE(o)->tp_as_number->nb_index ||
|
||||
Py_TYPE(o)->tp_as_number->nb_int ||
|
||||
Py_TYPE(o)->tp_as_number->nb_float);
|
||||
if (o == NULL)
|
||||
return 0;
|
||||
PyNumberMethods *nb = Py_TYPE(o)->tp_as_number;
|
||||
return nb && (nb->nb_index || nb->nb_int || nb->nb_float || PyComplex_Check(o));
|
||||
}
|
||||
|
||||
/* Binary operators */
|
||||
|
@ -1461,7 +1461,7 @@ PyNumber_Long(PyObject *o)
|
|||
}
|
||||
|
||||
return type_error("int() argument must be a string, a bytes-like object "
|
||||
"or a number, not '%.200s'", o);
|
||||
"or a real number, not '%.200s'", o);
|
||||
}
|
||||
|
||||
PyObject *
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue