diff -u -r old/Include/stringobject.h new/Include/stringobject.h --- old/Include/stringobject.h 2003-07-01 13:15:21.000000000 -0700 +++ new/Include/stringobject.h 2004-10-25 16:01:32.381195821 -0700 @@ -80,6 +80,11 @@ /* Macro, trading safety for speed */ #define PyString_AS_STRING(op) (((PyStringObject *)(op))->ob_sval) #define PyString_GET_SIZE(op) (((PyStringObject *)(op))->ob_size) +#define PyString_INVALIDATE(op) \ + do { \ + ((PyStringObject *)(op))->ob_shash = -1; \ + ((PyStringObject *)(op))->ob_sstate = SSTATE_NOT_INTERNED; \ + } while (0) /* _PyString_Join(sep, x) is like sep.join(x). sep must be PyStringObject*, x must be an iterable object. */ diff -u -r old/Python/ceval.c new/Python/ceval.c --- old/Python/ceval.c 2004-10-10 19:40:50.000000000 -0700 +++ new/Python/ceval.c 2004-10-25 16:13:59.172247438 -0700 @@ -4284,6 +4284,8 @@ /* copy 'w' into the newly allocated area of 'v' */ memcpy(PyString_AS_STRING(v) + v_len, PyString_AS_STRING(w), w_len); + /* we must also invalidate the cached hash value! */ + PyString_INVALIDATE(v); return v; } else {