bpo-37999: No longer use __int__ in implicit integer conversions. (GH-15636)
Only __index__ should be used to make integer conversions lossless.
diff --git a/Modules/clinic/itertoolsmodule.c.h b/Modules/clinic/itertoolsmodule.c.h
index 20594b0..c6d6717 100644
--- a/Modules/clinic/itertoolsmodule.c.h
+++ b/Modules/clinic/itertoolsmodule.c.h
@@ -170,11 +170,6 @@
if (nargs < 2) {
goto skip_optional;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
{
Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[1]);
@@ -356,11 +351,6 @@
goto exit;
}
iterable = fastargs[0];
- if (PyFloat_Check(fastargs[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
{
Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(fastargs[1]);
@@ -409,11 +399,6 @@
goto exit;
}
iterable = fastargs[0];
- if (PyFloat_Check(fastargs[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
{
Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(fastargs[1]);
@@ -642,4 +627,4 @@
exit:
return return_value;
}
-/*[clinic end generated code: output=392c9706e79f6710 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=07211f86c4153050 input=a9049054013a1b77]*/