bpo-37999: No longer use __int__ in implicit integer conversions. (GH-15636)

Only __index__ should be used to make integer conversions lossless.
This commit is contained in:
Serhiy Storchaka
2020-05-26 18:43:38 +03:00
committed by GitHub
parent 8ad052464a
commit 578c3955e0
87 changed files with 226 additions and 2937 deletions

View File

@@ -281,12 +281,6 @@ _io__WindowsConsoleIO___init___impl(winconsoleio *self, PyObject *nameobj,
self->handle = INVALID_HANDLE_VALUE;
}
if (PyFloat_Check(nameobj)) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float");
return -1;
}
fd = _PyLong_AsInt(nameobj);
if (fd < 0) {
if (!PyErr_Occurred()) {