Fixes issue #16772: int() constructor second argument (base) must be an int.
Consistent with the behavior in Python 2.
diff --git a/Objects/longobject.c b/Objects/longobject.c
index 4024491..e4d4df4 100644
--- a/Objects/longobject.c
+++ b/Objects/longobject.c
@@ -4260,6 +4260,11 @@
return PyLong_FromLong(0L);
if (obase == NULL)
return PyNumber_Long(x);
+ if (!PyLong_Check(obase)) {
+ PyErr_SetString(PyExc_TypeError,
+ "int() arg 2 must be an integer.");
+ return NULL;
+ }
base = PyLong_AsLongAndOverflow(obase, &overflow);
if (base == -1 && PyErr_Occurred())