diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2015-03-20 07:00:36 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2015-03-20 07:00:36 (GMT) |
commit | 8490f5acfee7269ac0eb41257a3a214dfb31a655 (patch) | |
tree | 7cd039c0f6418571d9f8cc89741c3ec4938f2ebc /Modules/_ssl.c | |
parent | 0eac13052c498e21cbb60ed321e5a9ea10d07b35 (diff) | |
download | cpython-8490f5acfee7269ac0eb41257a3a214dfb31a655.zip cpython-8490f5acfee7269ac0eb41257a3a214dfb31a655.tar.gz cpython-8490f5acfee7269ac0eb41257a3a214dfb31a655.tar.bz2 |
Issue #23001: Few functions in modules mmap, ossaudiodev, socket, ssl, and
codecs, that accepted only read-only bytes-like object now accept writable
bytes-like object too.
Diffstat (limited to 'Modules/_ssl.c')
-rw-r--r-- | Modules/_ssl.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Modules/_ssl.c b/Modules/_ssl.c index fb03513..be6fca3 100644 --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -3672,18 +3672,22 @@ static PyTypeObject PySSLMemoryBIO_Type = { static PyObject * PySSL_RAND_add(PyObject *self, PyObject *args) { - char *buf; + Py_buffer view; + const char *buf; Py_ssize_t len, written; double entropy; - if (!PyArg_ParseTuple(args, "s#d:RAND_add", &buf, &len, &entropy)) + if (!PyArg_ParseTuple(args, "s*d:RAND_add", &view, &entropy)) return NULL; + buf = (const char *)view.buf; + len = view.len; do { written = Py_MIN(len, INT_MAX); RAND_add(buf, (int)written, entropy); buf += written; len -= written; } while (len); + PyBuffer_Release(&view); Py_INCREF(Py_None); return Py_None; } |