summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authoregon <egon@debian-vm>2008-07-04 20:32:07 +0200
committeregon <egon@debian-vm>2008-07-04 20:32:07 +0200
commitdad1fa9e646f048542c4a602be5e4bc1366c5b2a (patch)
tree28a79d3cbd61bc661a2fd2ebacbb0a04b812f741 /python
parentdf08cc2180c01039428effeead8a004552d5dd36 (diff)
parent844d8f7494027c9dc205d528cafcc4fb2a64f61b (diff)
downloadpython-apt-dad1fa9e646f048542c4a602be5e4bc1366c5b2a.tar.gz
merged from the mvo branch
Diffstat (limited to 'python')
-rw-r--r--python/apt_pkgmodule.cc15
1 files changed, 12 insertions, 3 deletions
diff --git a/python/apt_pkgmodule.cc b/python/apt_pkgmodule.cc
index ae1cf7be..fd7a83cd 100644
--- a/python/apt_pkgmodule.cc
+++ b/python/apt_pkgmodule.cc
@@ -175,8 +175,11 @@ static PyObject *md5sum(PyObject *Self,PyObject *Args)
// Digest of a string.
if (PyString_Check(Obj) != 0)
{
+ char *s;
+ Py_ssize_t len;
MD5Summation Sum;
- Sum.Add(PyString_AsString(Obj));
+ PyString_AsStringAndSize(Obj, &s, &len);
+ Sum.Add((const unsigned char*)s, len);
return CppPyString(Sum.Result().Value());
}
@@ -212,8 +215,11 @@ static PyObject *sha1sum(PyObject *Self,PyObject *Args)
// Digest of a string.
if (PyString_Check(Obj) != 0)
{
+ char *s;
+ Py_ssize_t len;
SHA1Summation Sum;
- Sum.Add(PyString_AsString(Obj));
+ PyString_AsStringAndSize(Obj, &s, &len);
+ Sum.Add((const unsigned char*)s, len);
return CppPyString(Sum.Result().Value());
}
@@ -249,8 +255,11 @@ static PyObject *sha256sum(PyObject *Self,PyObject *Args)
// Digest of a string.
if (PyString_Check(Obj) != 0)
{
+ char *s;
+ Py_ssize_t len;
SHA256Summation Sum;
- Sum.Add(PyString_AsString(Obj));
+ PyString_AsStringAndSize(Obj, &s, &len);
+ Sum.Add((const unsigned char*)s, len);
return CppPyString(Sum.Result().Value());
}