Give the same treatment to the Connection.sendall method, allowing memoryview to be passed to it.
diff --git a/OpenSSL/ssl/connection.c b/OpenSSL/ssl/connection.c
index ccefcc8..f2881d3 100755
--- a/OpenSSL/ssl/connection.c
+++ b/OpenSSL/ssl/connection.c
@@ -392,8 +392,18 @@
int len, ret, err, flags;
PyObject *pyret = Py_None;
+#if PY_VERSION_HEX >= 0x02060000
+ Py_buffer pbuf;
+
+ if (!PyArg_ParseTuple(args, "s*|i:sendall", &pbuf, &flags))
+ return NULL;
+
+ buf = pbuf.buf;
+ len = pbuf.len;
+#else
if (!PyArg_ParseTuple(args, "s#|i:sendall", &buf, &len, &flags))
return NULL;
+#endif
do {
MY_BEGIN_ALLOW_THREADS(self->tstate)
@@ -417,9 +427,13 @@
handle_ssl_errors(self->ssl, err, ret);
pyret = NULL;
break;
- }
+ }
} while (len > 0);
+#if PY_VERSION_HEX >= 0x02060000
+ PyBuffer_Release(&pbuf);
+#endif
+
Py_XINCREF(pyret);
return pyret;
}