diff options
| author | Emanuele Rocca <ema@debian.org> | 2008-10-06 10:31:30 +0200 |
|---|---|---|
| committer | Emanuele Rocca <ema@debian.org> | 2008-10-06 10:31:30 +0200 |
| commit | 754744630ff6228029cd025074dc0cfe3de08495 (patch) | |
| tree | f97bb12295ac5b375f72b588f4b7f5eb42e7fee0 /python/cache.cc | |
| parent | 5363fda9e7ebdc4dd191183ece2e6e070d68d716 (diff) | |
| download | python-apt-754744630ff6228029cd025074dc0cfe3de08495.tar.gz | |
Test case and proposed fix for Debian bug #497049
Diffstat (limited to 'python/cache.cc')
| -rw-r--r-- | python/cache.cc | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/python/cache.cc b/python/cache.cc index bd280dec..523444b5 100644 --- a/python/cache.cc +++ b/python/cache.cc @@ -936,14 +936,25 @@ PyObject *TmpGetCache(PyObject *Self,PyObject *Args) pkgCacheFile *Cache = new pkgCacheFile(); if(pyCallbackInst != 0) { + if (PyObject_HasAttrString(pyCallbackInst, "done") != 1) { + PyErr_SetString(PyExc_ValueError, + "progress object must implement done()"); + return 0; + } + if (PyObject_HasAttrString(pyCallbackInst, "update") != 1) { + PyErr_SetString(PyExc_ValueError, + "progress object must implement update()"); + return 0; + } PyOpProgress progress; progress.setCallbackInst(pyCallbackInst); if (Cache->Open(progress,false) == false) - return HandleErrors(); - } else { + return HandleErrors(); + } + else { OpTextProgress Prog; if (Cache->Open(Prog,false) == false) - return HandleErrors(); + return HandleErrors(); } CppOwnedPyObject<pkgCacheFile*> *CacheFileObj = |
