summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
Diffstat (limited to 'Python')
-rw-r--r--Python/bltinmodule.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
index 7fc6f57..a17c6d9 100644
--- a/Python/bltinmodule.c
+++ b/Python/bltinmodule.c
@@ -153,15 +153,11 @@ builtin_filter(PyObject *self, PyObject *args)
return NULL;
/* Guess a result list size. */
- len = -1; /* unknown */
- if (PySequence_Check(seq) &&
- seq->ob_type->tp_as_sequence->sq_length) {
- len = PySequence_Size(seq);
- if (len < 0)
- PyErr_Clear();
+ len = PyObject_Size(seq);
+ if (len < 0) {
+ PyErr_Clear();
+ len = 8; /* arbitrary */
}
- if (len < 0)
- len = 8; /* arbitrary */
/* Pre-allocate argument list tuple. */
arg = PyTuple_New(1);