diff options
Diffstat (limited to 'Objects/abstract.c')
-rw-r--r-- | Objects/abstract.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/Objects/abstract.c b/Objects/abstract.c index 410b80b..79af2f8 100644 --- a/Objects/abstract.c +++ b/Objects/abstract.c @@ -1207,6 +1207,26 @@ PySequence_List(v) return type_error("list() argument must be a sequence"); } +PyObject * +PySequence_Fast(v, m) + PyObject *v; + const char* m; +{ + if (v == NULL) + return null_error(); + + if (PyList_Check(v) || PyTuple_Check(v)) { + Py_INCREF(v); + return v; + } + + v = PySequence_Tuple(v); + if (v == NULL && PyErr_ExceptionMatches(PyExc_TypeError)) + return type_error(m); + + return v; +} + int PySequence_Count(s, o) PyObject *s; |