pyopenssl
pyopenssl copied to clipboard
bytearray is a bytes-like object
In [1]: from OpenSSL import SSL
In [2]: ctx = SSL.Context(SSL.SSLv23_METHOD)
In [3]: conn = SSL.Connection(ctx, None)
In [4]: conn.set_accept_state()
In [5]: conn.send(bytearray(10))
TypeError: data must be a memoryview, buffer or byte string
But bytearrays are nice and friendly and deserve your love too!
Actually I'd expect that it should accept anything that implements the buffer interface, using ffi.from_buffer.
Realistically I think this probably does work with bytearray objects, and there's just a slightly overzealous isinstance check in front of the code.
Assuming that's true the fix is really easy. I'll quickly prototype that up to see if it works, and if it does I'll submit the patch.
See #622.