I'm on swig-1.3.31.
The way vectors are wrapped, getting an item out of a vector will return an object that is effectively a wrapped pointer, but its validity depends on the lifespan of the vector.
v = vector()
item = v
I didn't notice this being documented anywhere.
Note that this is the kind of code I was getting a crash on:
Python optimistically decrefs the result of get() after calling __getitem__ but before __getattr__. It took me a while to understand this and realize why it was crashing.
I think the bug in all of this is that __getitem__ does not increase the reference count of the vector instance it is a member of, and python may choose to delete the vector while objects that refer to its memory still exist.
Ideally the object wrapping the result of v would hold a reference to v to prevent this dangling pointer problem.