summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debian/changelog2
-rw-r--r--python/progress.cc5
-rw-r--r--tests/test_progress.py3
3 files changed, 9 insertions, 1 deletions
diff --git a/debian/changelog b/debian/changelog
index 98be965a..b592eb84 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -24,6 +24,8 @@ python-apt (0.7.96) UNRELEASED; urgency=low
- fix py3 compatibility
* tests/test_debs/*.deb, tests/test_debfile.py:
- add automatic test based on the test debs from gdebi
+ * python/progress.cc:
+ - deal with missing return value from the acquire progress in pulse()
[ Martin Pitt ]
* tests/test_apt_cache.py: Test accessing the record of all packages during
diff --git a/python/progress.cc b/python/progress.cc
index 9002b3eb..437309cf 100644
--- a/python/progress.cc
+++ b/python/progress.cc
@@ -300,7 +300,10 @@ bool PyFetchProgress::Pulse(pkgAcquire * Owner)
Py_INCREF(pyAcquire);
if (RunSimpleCallback("pulse", TUPLEIZE(pyAcquire) , &result1)) {
- if (result1 != NULL && PyArg_Parse(result1, "b", &res1) && res1 == false) {
+ if (result1 != NULL &&
+ result1 != Py_None &&
+ PyArg_Parse(result1, "b", &res1) &&
+ res1 == false) {
// the user returned a explicit false here, stop
PyCbObj_BEGIN_ALLOW_THREADS
return false;
diff --git a/tests/test_progress.py b/tests/test_progress.py
index 2ab8ce5e..ffab5bc0 100644
--- a/tests/test_progress.py
+++ b/tests/test_progress.py
@@ -15,6 +15,9 @@ import os
class TestAcquireProgress(apt.progress.base.AcquireProgress):
def pulse(self, owner):
self.pulsed = True
+ # there should be a return value here, either (True,False)
+ # but often this is forgoten (and causes odd error messages)
+ # so the lib supports it. we test the lack of support value here
class TestProgress(unittest.TestCase):