It is not that clear from docs and can't test this right now but this might work:
// make everything immutable except str2 data member:
%feature("immutable","1");
%feature("immutable","0") MyClass::str2;
class MyClass {
public:
char *str1;
char *str2;
char *str3;
};
If that doesn't work you could also try moving the statement inside the class:
class MyClass {
public:
// make everything immutable except str2 data member:
%immutable;
char *str0;
char *str1;
%mutable;
char *str2;
%immutable;
char *str3;
char *str4;
};