summaryrefslogtreecommitdiffstats
path: root/Objects/abstract.c
diff options
context:
space:
mode:
authorAlexandre Vassalotti <alexandre@peadrop.com>2007-12-04 06:20:30 (GMT)
committerAlexandre Vassalotti <alexandre@peadrop.com>2007-12-04 06:20:30 (GMT)
commit79a082b7159d697f6b63e967f18e18cee0c82db7 (patch)
treef8e9895453f3fbccceadc8b7618a58a1a21791cf /Objects/abstract.c
parenta74169b7c13bb081380a463541e80b7ba6934abd (diff)
downloadcpython-79a082b7159d697f6b63e967f18e18cee0c82db7.zip
cpython-79a082b7159d697f6b63e967f18e18cee0c82db7.tar.gz
cpython-79a082b7159d697f6b63e967f18e18cee0c82db7.tar.bz2
Fix issue #1553: An errornous __length_hint__ can make list() raise a
SystemError.
Diffstat (limited to 'Objects/abstract.c')
-rw-r--r--Objects/abstract.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/Objects/abstract.c b/Objects/abstract.c
index 965d088..df5da5f 100644
--- a/Objects/abstract.c
+++ b/Objects/abstract.c
@@ -1657,8 +1657,9 @@ PySequence_Tuple(PyObject *v)
/* Guess result size and allocate space. */
n = _PyObject_LengthHint(v);
if (n < 0) {
- if (!PyErr_ExceptionMatches(PyExc_TypeError) &&
- !PyErr_ExceptionMatches(PyExc_AttributeError)) {
+ if (PyErr_Occurred()
+ && !PyErr_ExceptionMatches(PyExc_TypeError)
+ && !PyErr_ExceptionMatches(PyExc_AttributeError)) {
Py_DECREF(it);
return NULL;
}