summaryrefslogtreecommitdiffstats
path: root/Objects/intobject.c
diff options
context:
space:
mode:
authorNeil Schemenauer <nascheme@enme.ucalgary.ca>2004-07-19 16:29:17 (GMT)
committerNeil Schemenauer <nascheme@enme.ucalgary.ca>2004-07-19 16:29:17 (GMT)
commit3a313e36555a3416799f3c049b8ebb41e9edeb8a (patch)
tree0e58c64208e51ae38be4292abf732a5177dd59c3 /Objects/intobject.c
parent66edb6295f956af9c559ef037c5016c9f6b64261 (diff)
downloadcpython-3a313e36555a3416799f3c049b8ebb41e9edeb8a.zip
cpython-3a313e36555a3416799f3c049b8ebb41e9edeb8a.tar.gz
cpython-3a313e36555a3416799f3c049b8ebb41e9edeb8a.tar.bz2
Check the type of values returned by __int__, __float__, __long__,
__oct__, and __hex__. Raise TypeError if an invalid type is returned. Note that PyNumber_Int and PyNumber_Long can still return ints or longs. Fixes SF bug #966618.
Diffstat (limited to 'Objects/intobject.c')
-rw-r--r--Objects/intobject.c6
1 files changed, 0 insertions, 6 deletions
diff --git a/Objects/intobject.c b/Objects/intobject.c
index bdf7da3..f52ef07 100644
--- a/Objects/intobject.c
+++ b/Objects/intobject.c
@@ -948,12 +948,6 @@ int_subtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
if (tmp == NULL)
return NULL;
if (!PyInt_Check(tmp)) {
- if (!PyLong_Check(tmp)) {
- PyErr_SetString(PyExc_ValueError,
- "value can't be converted to int");
- Py_DECREF(tmp);
- return NULL;
- }
ival = PyLong_AsLong(tmp);
if (ival == -1 && PyErr_Occurred()) {
Py_DECREF(tmp);