summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2009-05-25 03:10:48 (GMT)
committerBenjamin Peterson <benjamin@python.org>2009-05-25 03:10:48 (GMT)
commit94c65d9a8ff8ec56c2420f46a6622803f7f1b154 (patch)
tree2b89b8c34e06c7a7c8b5b2076f551af956a0477e /Objects
parent14a3dd716d2da4158739e502e8af8ef12e944cac (diff)
downloadcpython-94c65d9a8ff8ec56c2420f46a6622803f7f1b154.zip
cpython-94c65d9a8ff8ec56c2420f46a6622803f7f1b154.tar.gz
cpython-94c65d9a8ff8ec56c2420f46a6622803f7f1b154.tar.bz2
Merged revisions 72907 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r72907 | benjamin.peterson | 2009-05-24 21:40:21 -0500 (Sun, 24 May 2009) | 1 line handle errors from _PyObject_LookupSpecial when __get__ fails ........
Diffstat (limited to 'Objects')
-rw-r--r--Objects/abstract.c12
-rw-r--r--Objects/enumobject.c2
-rw-r--r--Objects/object.c2
3 files changed, 14 insertions, 2 deletions
diff --git a/Objects/abstract.c b/Objects/abstract.c
index 56e5b71..3b2de9d 100644
--- a/Objects/abstract.c
+++ b/Objects/abstract.c
@@ -90,8 +90,12 @@ _PyObject_LengthHint(PyObject *o, Py_ssize_t defaultvalue)
/* try o.__length_hint__() */
hintmeth = _PyObject_LookupSpecial(o, "__length_hint__", &hintstrobj);
- if (hintmeth == NULL)
- return defaultvalue;
+ if (hintmeth == NULL) {
+ if (PyErr_Occurred())
+ return -1;
+ else
+ return defaultvalue;
+ }
ro = PyObject_CallFunctionObjArgs(hintmeth, NULL);
Py_DECREF(hintmeth);
if (ro == NULL) {
@@ -2592,6 +2596,8 @@ PyObject_IsInstance(PyObject *inst, PyObject *cls)
}
return ok;
}
+ else if (PyErr_Occurred())
+ return -1;
return recursive_isinstance(inst, cls);
}
@@ -2655,6 +2661,8 @@ PyObject_IsSubclass(PyObject *derived, PyObject *cls)
}
return ok;
}
+ else if (PyErr_Occurred())
+ return -1;
return recursive_issubclass(derived, cls);
}
diff --git a/Objects/enumobject.c b/Objects/enumobject.c
index f8e4072..62e55bb 100644
--- a/Objects/enumobject.c
+++ b/Objects/enumobject.c
@@ -238,6 +238,8 @@ reversed_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
Py_DECREF(reversed_meth);
return res;
}
+ else if (PyErr_Occurred())
+ return NULL;
if (!PySequence_Check(seq)) {
PyErr_SetString(PyExc_TypeError,
diff --git a/Objects/object.c b/Objects/object.c
index 58b70f0..a29c31a 100644
--- a/Objects/object.c
+++ b/Objects/object.c
@@ -497,6 +497,8 @@ PyObject_Bytes(PyObject *v)
}
return result;
}
+ else if (PyErr_Occurred())
+ return NULL;
return PyBytes_FromObject(v);
}