diff options
Diffstat (limited to 'Include/abstract.h')
-rw-r--r-- | Include/abstract.h | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/Include/abstract.h b/Include/abstract.h index d736efc..351149d 100644 --- a/Include/abstract.h +++ b/Include/abstract.h @@ -951,26 +951,30 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ DL_IMPORT(PyObject *) PySequence_List(PyObject *o); - /* Returns the sequence, o, as a list on success, and NULL on failure. This is equivalent to the Python expression: list(o) */ DL_IMPORT(PyObject *) PySequence_Fast(PyObject *o, const char* m); - /* Returns the sequence, o, as a tuple, unless it's already a tuple or list. Use PySequence_Fast_GET_ITEM to access the - members of this list. + members of this list, and PySequence_Fast_GET_SIZE to get its length. Returns NULL on failure. If the object does not support iteration, raises a TypeError exception with m as the message text. */ +#define PySequence_Fast_GET_SIZE(o) \ + (PyList_Check(o) ? PyList_GET_SIZE(o) : PyTuple_GET_SIZE(o)) + /* + Return the size of o, assuming that o was returned by + PySequence_Fast and is not NULL. + */ + #define PySequence_Fast_GET_ITEM(o, i)\ (PyList_Check(o) ? PyList_GET_ITEM(o, i) : PyTuple_GET_ITEM(o, i)) - /* Return the ith element of o, assuming that o was returned by PySequence_Fast, and that i is within bounds. |