Issue #16772: in int(x, base), non-integer bases must have an __index__ method.

This commit is contained in:
Mark Dickinson 2013-01-27 10:17:52 +00:00
parent 3a62e45b97
commit 07c7136524
4 changed files with 27 additions and 5 deletions

View file

@ -4283,11 +4283,6 @@ long_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
}
if (obase == NULL)
return PyNumber_Long(x);
if (!PyLong_Check(obase)) {
PyErr_SetString(PyExc_TypeError,
"int() base must be an integer.");
return NULL;
}
base = PyNumber_AsSsize_t(obase, NULL);
if (base == -1 && PyErr_Occurred())