mirror of
https://github.com/python/cpython.git
synced 2025-12-11 03:20:01 +00:00
Refuse to compute digests from PyUnicode (str) instances.
This breaks a few things that I'll patch up in a minute.
This commit is contained in:
parent
b3cf6fd58e
commit
3227af454c
1 changed files with 2 additions and 2 deletions
|
|
@ -153,12 +153,12 @@ EVP_hexdigest(EVPobject *self, PyObject *unused)
|
||||||
}
|
}
|
||||||
|
|
||||||
#define MY_GET_BUFFER_VIEW_OR_ERROUT(obj, viewp) do { \
|
#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, \
|
PyErr_SetString(PyExc_TypeError, \
|
||||||
"object supporting the buffer API required"); \
|
"object supporting the buffer API required"); \
|
||||||
return NULL; \
|
return NULL; \
|
||||||
} \
|
} \
|
||||||
if (PyObject_GetBuffer((obj), (viewp), PyBUF_CHARACTER) == -1) { \
|
if (PyObject_GetBuffer((obj), (viewp), PyBUF_SIMPLE) == -1) { \
|
||||||
return NULL; \
|
return NULL; \
|
||||||
} \
|
} \
|
||||||
if ((viewp)->ndim > 1) { \
|
if ((viewp)->ndim > 1) { \
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue