`PyObject_GetBuffer` was used without checking that it was successful. This could cause the code to access an incompatible or uninitialized `Py_buffer`. Add the missing checks, and clears the raised `PyExc_BufferError` to silently fall back to accessing the PyObject as a sequence.