summaryrefslogtreecommitdiffstats
path: root/Include/abstract.h
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2004-03-12 08:04:00 (GMT)
committerRaymond Hettinger <python@rcn.com>2004-03-12 08:04:00 (GMT)
commitc1e4f9dd92a2b63b26b06035f8c8ee1a5eb52ab3 (patch)
tree9bac712f5696672bf2817eeda0b515e9aa891653 /Include/abstract.h
parent989ddc0709e98c1a5b3480e0843cf7896fd2909e (diff)
downloadcpython-c1e4f9dd92a2b63b26b06035f8c8ee1a5eb52ab3.zip
cpython-c1e4f9dd92a2b63b26b06035f8c8ee1a5eb52ab3.tar.gz
cpython-c1e4f9dd92a2b63b26b06035f8c8ee1a5eb52ab3.tar.bz2
Use a new macro, PySequence_Fast_ITEMS to factor out code common to
three recent optimizations. Aside from reducing code volume, it increases readability.
Diffstat (limited to 'Include/abstract.h')
-rw-r--r--Include/abstract.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/Include/abstract.h b/Include/abstract.h
index 46aee29..bc9df05 100644
--- a/Include/abstract.h
+++ b/Include/abstract.h
@@ -1016,6 +1016,12 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
need to be corrected for a negative index
*/
+#define _PySequence_Fast_ITEMS(sf) \
+ (PyList_Check(sf) ? ((PyListObject *)(sf))->ob_item \
+ : ((PyTupleObject *)(sf))->ob_item)
+ /* Return a pointer to the underlying item array for
+ an object retured by PySequence_Fast */
+
PyAPI_FUNC(int) PySequence_Count(PyObject *o, PyObject *value);
/*