Commit 3227af45 authored by Guido van Rossum's avatar Guido van Rossum

Refuse to compute digests from PyUnicode (str) instances.

This breaks a few things that I'll patch up in a minute.
parent b3cf6fd5
......@@ -153,12 +153,12 @@ EVP_hexdigest(EVPobject *self, PyObject *unused)
}
#define MY_GET_BUFFER_VIEW_OR_ERROUT(obj, viewp) do { \
if (!PyObject_CheckBuffer((obj))) { \
if (PyUnicode_Check(obj) || !PyObject_CheckBuffer((obj))) { \
PyErr_SetString(PyExc_TypeError, \
"object supporting the buffer API required"); \
return NULL; \
} \
if (PyObject_GetBuffer((obj), (viewp), PyBUF_CHARACTER) == -1) { \
if (PyObject_GetBuffer((obj), (viewp), PyBUF_SIMPLE) == -1) { \
return NULL; \
} \
if ((viewp)->ndim > 1) { \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment