diff options
author | Gregory P. Smith <greg@krypto.org> | 2012-12-25 21:05:31 (GMT) |
---|---|---|
committer | Gregory P. Smith <greg@krypto.org> | 2012-12-25 21:05:31 (GMT) |
commit | 4fbbf8c0a3c4b06853befc9f43e2fc5e80ccc197 (patch) | |
tree | 36b7795c47960f48b959c56d323522e7d97a5838 /Objects/longobject.c | |
parent | 6d469ebbc8577107203283647caf2bbc50a68497 (diff) | |
download | cpython-4fbbf8c0a3c4b06853befc9f43e2fc5e80ccc197.zip cpython-4fbbf8c0a3c4b06853befc9f43e2fc5e80ccc197.tar.gz cpython-4fbbf8c0a3c4b06853befc9f43e2fc5e80ccc197.tar.bz2 |
Fixes issue #16772: int() constructor second argument (base) must be an int.
Consistent with the behavior in Python 2.
Diffstat (limited to 'Objects/longobject.c')
-rw-r--r-- | Objects/longobject.c | 5 |
1 files changed, 5 insertions, 0 deletions
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 @@ long_new(PyTypeObject *type, PyObject *args, PyObject *kwds) 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()) |