mirror of
https://github.com/python/cpython.git
synced 2025-11-01 10:45:30 +00:00
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.
This commit is contained in:
parent
0eac13052c
commit
8490f5acfe
14 changed files with 196 additions and 104 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue