diff -r ba32b8c7f5be Objects/unicodeobject.c --- a/Objects/unicodeobject.c Sat Mar 31 14:10:10 2012 +0300 +++ b/Objects/unicodeobject.c Sat Apr 14 21:54:11 2012 +0300 @@ -3606,6 +3606,9 @@ &outpos, &p)) goto onError; + /* Update data because unicode_decode_call_errorhandler might have + re-created or resized the unicode object. */ + aligned_end = (const unsigned char *) ((size_t) e & ~LONG_PTR_MASK); } /* remaining byte at the end? (size should be even) */ if (e == q) {