summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-08-29 14:21:45 (GMT)
committerGuido van Rossum <guido@python.org>2007-08-29 14:21:45 (GMT)
commit3227af454cd14d3843b11ab7609cd1b06e87a6af (patch)
tree63caaf85c31064f04f8cfb602316c5b48ba02236 /Modules
parentb3cf6fd58ecf74c669b8bae2d7804182565f879f (diff)
downloadcpython-3227af454cd14d3843b11ab7609cd1b06e87a6af.zip
cpython-3227af454cd14d3843b11ab7609cd1b06e87a6af.tar.gz
cpython-3227af454cd14d3843b11ab7609cd1b06e87a6af.tar.bz2
Refuse to compute digests from PyUnicode (str) instances.
This breaks a few things that I'll patch up in a minute.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_hashopenssl.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Modules/_hashopenssl.c b/Modules/_hashopenssl.c
index 9ee1b3d..ad38cfd 100644
--- a/Modules/_hashopenssl.c
+++ b/Modules/_hashopenssl.c
@@ -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) { \