summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
Diffstat (limited to 'Objects')
-rw-r--r--Objects/abstract.c5
-rw-r--r--Objects/listobject.c5
2 files changed, 10 insertions, 0 deletions
diff --git a/Objects/abstract.c b/Objects/abstract.c
index cade2aa..94af3da 100644
--- a/Objects/abstract.c
+++ b/Objects/abstract.c
@@ -1401,6 +1401,11 @@ PySequence_Tuple(PyObject *v)
/* Guess result size and allocate space. */
n = PyObject_Size(v);
if (n < 0) {
+ if (!PyErr_ExceptionMatches(PyExc_TypeError) &&
+ !PyErr_ExceptionMatches(PyExc_AttributeError)) {
+ Py_DECREF(it);
+ return NULL;
+ }
PyErr_Clear();
n = 10; /* arbitrary */
}
diff --git a/Objects/listobject.c b/Objects/listobject.c
index 08ab095..3b7358a 100644
--- a/Objects/listobject.c
+++ b/Objects/listobject.c
@@ -777,6 +777,11 @@ listextend(PyListObject *self, PyObject *b)
/* Guess a result list size. */
n = PyObject_Size(b);
if (n < 0) {
+ if (!PyErr_ExceptionMatches(PyExc_TypeError) &&
+ !PyErr_ExceptionMatches(PyExc_AttributeError)) {
+ Py_DECREF(it);
+ return NULL;
+ }
PyErr_Clear();
n = 8; /* arbitrary */
}