mirror of
https://github.com/python/cpython.git
synced 2025-08-02 16:13:13 +00:00
Issue #16772: in int(x, base), non-integer bases must have an __index__ method.
This commit is contained in:
parent
3a62e45b97
commit
07c7136524
4 changed files with 27 additions and 5 deletions
|
@ -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())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue