diff options
Diffstat (limited to 'Objects/abstract.c')
-rw-r--r-- | Objects/abstract.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/Objects/abstract.c b/Objects/abstract.c index 1259ad4..342d971 100644 --- a/Objects/abstract.c +++ b/Objects/abstract.c @@ -1448,15 +1448,11 @@ PySequence_List(PyObject *v) return NULL; /* Guess a result list size. */ - n = -1; /* unknown */ - if (PySequence_Check(v) && - v->ob_type->tp_as_sequence->sq_length) { - n = PySequence_Size(v); - if (n < 0) - PyErr_Clear(); - } - if (n < 0) + n = PyObject_Size(v); + if (n < 0) { + PyErr_Clear(); n = 8; /* arbitrary */ + } result = PyList_New(n); if (result == NULL) { Py_DECREF(it); |