Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(158446)

Unified Diff: Modules/_ssl.c

Issue 23001: Accept mutable bytes-like objects
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« Modules/fcntlmodule.c ('K') | « Modules/socketmodule.c ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
--- a/Modules/_ssl.c Wed Mar 18 21:36:23 2015 -0500
+++ b/Modules/_ssl.c Thu Mar 19 13:16:44 2015 +0200
@@ -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;
}
« Modules/fcntlmodule.c ('K') | « Modules/socketmodule.c ('k') | no next file » | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+