Index: Modules/_struct.c =================================================================== --- Modules/_struct.c (Revision 66049) +++ Modules/_struct.c (Arbeitskopie) @@ -1779,13 +1779,16 @@ /* Extract a writable memory buffer from the first argument */ if ( PyObject_AsWriteBuffer(PyTuple_GET_ITEM(args, 0), - (void**)&buffer, &buffer_len) == -1 ) { + (void**)&buffer, &buffer_len) == -1 ) { return NULL; } assert( buffer_len >= 0 ); /* Extract the offset from the first argument */ offset = PyLong_AsSsize_t(PyTuple_GET_ITEM(args, 1)); + if (offset == -1 && PyErr_Occurred()) { + return NULL; + } /* Support negative offsets. */ if (offset < 0)