summaryrefslogtreecommitdiffstats
path: root/Include/abstract.h
diff options
context:
space:
mode:
authorAndrew M. Kuchling <amk@amk.ca>2000-06-18 18:43:14 (GMT)
committerAndrew M. Kuchling <amk@amk.ca>2000-06-18 18:43:14 (GMT)
commit74042d6e5d44cc9d332c28414a1e04eadd204248 (patch)
tree888efb4a5da65b5fed5d282d019af6fb29fefe0b /Include/abstract.h
parentb75c485f0bc6394f616d4a0bc746e613fd7b1021 (diff)
downloadcpython-74042d6e5d44cc9d332c28414a1e04eadd204248.zip
cpython-74042d6e5d44cc9d332c28414a1e04eadd204248.tar.gz
cpython-74042d6e5d44cc9d332c28414a1e04eadd204248.tar.bz2
Patch from /F:
this patch introduces PySequence_Fast and PySequence_Fast_GET_ITEM, and modifies the list.extend method to accept any kind of sequence.
Diffstat (limited to 'Include/abstract.h')
-rw-r--r--Include/abstract.h21
1 files changed, 20 insertions, 1 deletions
diff --git a/Include/abstract.h b/Include/abstract.h
index 12d799d..70c0e7c 100644
--- a/Include/abstract.h
+++ b/Include/abstract.h
@@ -731,7 +731,6 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
/*
Return the ith element of o, or NULL on failure. This is the
equivalent of the Python expression: o[i].
-
*/
DL_IMPORT(PyObject *) PySequence_GetSlice Py_PROTO((PyObject *o, int i1, int i2));
@@ -783,6 +782,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
This is equivalent to the Python expression: tuple(o)
*/
+
DL_IMPORT(PyObject *) PySequence_List Py_PROTO((PyObject *o));
/*
@@ -790,6 +790,25 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
This is equivalent to the Python expression: list(o)
*/
+ DL_IMPORT(PyObject *) PySequence_Fast Py_PROTO((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.
+
+ Returns NULL on failure. If the object is not a sequence,
+ raises a TypeError exception with m as the message text.
+ */
+
+#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.
+ */
+
DL_IMPORT(int) PySequence_Count Py_PROTO((PyObject *o, PyObject *value));
/*