summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2012-12-28 08:02:42 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2012-12-28 08:02:42 (GMT)
commit00e284311565c2caeadd10faa75cbe261b71bdaf (patch)
tree7146794182c585f8cb1f0a12049f5074c8035503 /Objects
parent28441e353cbe95e1b2e26eb08d7b1969ca26d261 (diff)
parent0b386d524765d875fd5f7b6150219e5e5cd69abf (diff)
downloadcpython-00e284311565c2caeadd10faa75cbe261b71bdaf.zip
cpython-00e284311565c2caeadd10faa75cbe261b71bdaf.tar.gz
cpython-00e284311565c2caeadd10faa75cbe261b71bdaf.tar.bz2
Issue #16761: Raise TypeError when int() called with base argument only.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/longobject.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/Objects/longobject.c b/Objects/longobject.c
index 87150a9..9535830 100644
--- a/Objects/longobject.c
+++ b/Objects/longobject.c
@@ -4267,8 +4267,14 @@ long_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
if (!PyArg_ParseTupleAndKeywords(args, kwds, "|OO:int", kwlist,
&x, &obase))
return NULL;
- if (x == NULL)
+ if (x == NULL) {
+ if (obase != NULL) {
+ PyErr_SetString(PyExc_TypeError,
+ "int() missing string argument");
+ return NULL;
+ }
return PyLong_FromLong(0L);
+ }
if (obase == NULL)
return PyNumber_Long(x);
@@ -4277,7 +4283,7 @@ long_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
return NULL;
if (overflow || (base != 0 && base < 2) || base > 36) {
PyErr_SetString(PyExc_ValueError,
- "int() arg 2 must be >= 2 and <= 36");
+ "int() base must be >= 2 and <= 36");
return NULL;
}