summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorBen Finney <ben+debian@benfinney.id.au>2008-08-08 10:08:50 +1000
committerBen Finney <ben+debian@benfinney.id.au>2008-08-08 10:08:50 +1000
commit7b14352c54b7acbf2a68240fa960e188c6e8742a (patch)
tree48db4bb809d90743bdb7f6a6e3a429f83465d729 /python
parent08fa9a44bc90b88f05cd8aa14d50892fadda9049 (diff)
parent44d1746f2dd6c055f340f9368d6411a9b6170150 (diff)
downloadpython-apt-7b14352c54b7acbf2a68240fa960e188c6e8742a.tar.gz
Fix whitespace in changes from 0.7.7.
Diffstat (limited to 'python')
-rw-r--r--python/apt_pkgmodule.cc15
-rw-r--r--python/cache.cc5
-rw-r--r--python/pkgsrcrecords.cc2
3 files changed, 19 insertions, 3 deletions
diff --git a/python/apt_pkgmodule.cc b/python/apt_pkgmodule.cc
index bbb21523..ab8ab33d 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());
}
diff --git a/python/cache.cc b/python/cache.cc
index 8accd4a7..fe5e8902 100644
--- a/python/cache.cc
+++ b/python/cache.cc
@@ -928,6 +928,11 @@ PyObject *TmpGetCache(PyObject *Self,PyObject *Args)
if (PyArg_ParseTuple(Args, "|O", &pyCallbackInst) == 0)
return 0;
+ if (_system == 0) {
+ PyErr_SetString(PyExc_ValueError,"_system not initialized");
+ return 0;
+ }
+
pkgCacheFile *Cache = new pkgCacheFile();
if(pyCallbackInst != 0) {
diff --git a/python/pkgsrcrecords.cc b/python/pkgsrcrecords.cc
index 1a52e8f1..f7f5d7a2 100644
--- a/python/pkgsrcrecords.cc
+++ b/python/pkgsrcrecords.cc
@@ -89,6 +89,8 @@ static PyObject *PkgSrcRecordsAttr(PyObject *Self,char *Name)
return CppPyString(Struct.Last->Maintainer());
else if (strcmp("Section",Name) == 0)
return CppPyString(Struct.Last->Section());
+ else if (strcmp("Record",Name) == 0)
+ return CppPyString(Struct.Last->AsStr());
else if (strcmp("Binaries",Name) == 0) {
PyObject *List = PyList_New(0);