return converterr(
"bytes or read-only character buffer",
arg, msgbuf, bufsize);
+ if (pb->bf_releasebuffer)
+ return converterr(
+ "string or pinned buffer",
+ arg, msgbuf, bufsize);
if (PyObject_GetBuffer(arg, &view, PyBUF_SIMPLE) != 0)
return converterr("string or single-segment read-only buffer",
count = view.len;
*p = view.buf;
- if (pb->bf_releasebuffer)
- return converterr(
- "string or pinned buffer",
- arg, msgbuf, bufsize);
PyBuffer_Release(&view);
return -1;
}
if (!PyBuffer_IsContiguous(view, 'C')) {
+ PyBuffer_Release(view);
*errmsg = "contiguous buffer";
return -1;
}