From 8dbbb96929b6e8775d8b5d873dde48376410d274 Mon Sep 17 00:00:00 2001 From: Raymond Hettinger Date: Fri, 11 Jul 2008 12:00:21 +0000 Subject: Add cautionary note on the use of PySequence_Fast_ITEMS. --- Doc/c-api/sequence.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Doc/c-api/sequence.rst b/Doc/c-api/sequence.rst index 359bf6d..e16c2e3 100644 --- a/Doc/c-api/sequence.rst +++ b/Doc/c-api/sequence.rst @@ -143,6 +143,10 @@ Sequence Protocol Return the underlying array of PyObject pointers. Assumes that *o* was returned by :cfunc:`PySequence_Fast` and *o* is not *NULL*. + + Note, if a list gets resized, the reallocation may relocate the items array. + So, only use the underlying array pointer in contexts where the sequence + cannot change. .. versionadded:: 2.4 -- cgit v0.12