diff options
| author | Raymond Hettinger <python@rcn.com> | 2004-03-12 08:04:00 +0000 |
|---|---|---|
| committer | Raymond Hettinger <python@rcn.com> | 2004-03-12 08:04:00 +0000 |
| commit | c1e4f9dd92a2b63b26b06035f8c8ee1a5eb52ab3 (patch) | |
| tree | 9bac712f5696672bf2817eeda0b515e9aa891653 /Include | |
| parent | 989ddc0709e98c1a5b3480e0843cf7896fd2909e (diff) | |
| download | cpython-git-c1e4f9dd92a2b63b26b06035f8c8ee1a5eb52ab3.tar.gz | |
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')
| -rw-r--r-- | Include/abstract.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Include/abstract.h b/Include/abstract.h index 46aee297d0..bc9df05d84 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); /* |
