Apparently calling replace on a String that is contained in a List is a bad idea. Not sure why Swig uses its own custom data structures rather than the STL.