diff options
| author | Julian Andres Klode <jak@debian.org> | 2010-01-23 19:21:26 +0100 |
|---|---|---|
| committer | Julian Andres Klode <jak@debian.org> | 2010-01-23 19:21:26 +0100 |
| commit | c654ae4c10bf40922e2ecf8f1b7fe1c2b97a06aa (patch) | |
| tree | 3a17204be569cbb2131ff1a5913dcda56197476d | |
| parent | e29ff27343b203fd4150d6171efdc7e6ae5a68bf (diff) | |
| download | python-apt-c654ae4c10bf40922e2ecf8f1b7fe1c2b97a06aa.tar.gz | |
* python/progress.cc:
- Fix some threading issues (add some missing PyCbObj_BEGIN_ALLOW_THREADS)
| -rw-r--r-- | debian/changelog | 2 | ||||
| -rw-r--r-- | python/progress.cc | 11 |
2 files changed, 11 insertions, 2 deletions
diff --git a/debian/changelog b/debian/changelog index 95ca5b41..3fa0852f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,6 +3,8 @@ python-apt (0.7.93.1) UNRELEASED; urgency=low * Fix reference counting for old progress classes (Closes: #566370). * apt/cache.py: - Fix Cache.update() to not raise errors on successful updates. + * python/progress.cc: + - Fix some threading issues (add some missing PyCbObj_BEGIN_ALLOW_THREADS) -- Julian Andres Klode <jak@debian.org> Sat, 23 Jan 2010 15:35:55 +0100 diff --git a/python/progress.cc b/python/progress.cc index 63d9eede..0fc01085 100644 --- a/python/progress.cc +++ b/python/progress.cc @@ -133,6 +133,7 @@ bool PyFetchProgress::MediaChange(string Media, string Drive) bool res = true; if(!PyArg_Parse(result, "b", &res)) { // no return value or None, assume false + PyCbObj_BEGIN_ALLOW_THREADS return false; } @@ -201,12 +202,15 @@ void PyFetchProgress::Fail(pkgAcquire::ItemDesc &Itm) PyCbObj_END_ALLOW_THREADS if (PyObject_HasAttrString(callbackInst, "fail")) { RunSimpleCallback("fail", TUPLEIZE(PyAcquire_GetItemDesc(pyAcquire, &Itm))); + PyCbObj_BEGIN_ALLOW_THREADS return; } // Ignore certain kinds of transient failures (bad code) - if (Itm.Owner->Status == pkgAcquire::Item::StatIdle) + if (Itm.Owner->Status == pkgAcquire::Item::StatIdle) { + PyCbObj_BEGIN_ALLOW_THREADS return; + } if (Itm.Owner->Status == pkgAcquire::Item::StatDone) { @@ -262,8 +266,10 @@ bool PyFetchProgress::Pulse(pkgAcquire * Owner) pkgAcquireStatus::Pulse(Owner); //std::cout << "Pulse" << std::endl; - if(callbackInst == 0) + if(callbackInst == 0) { + PyCbObj_BEGIN_ALLOW_THREADS return false; + } setattr(callbackInst, "last_bytes", "d", LastBytes); setattr(callbackInst, "current_cps", "d", CurrentCPS); @@ -496,6 +502,7 @@ pkgPackageManager::OrderResult PyInstallProgress::Run(pkgPackageManager *pm) if (result == NULL) { std::cerr << "waitChild method invalid" << std::endl; PyErr_Print(); + PyCbObj_BEGIN_ALLOW_THREADS return pkgPackageManager::Failed; } if(!PyArg_Parse(result, "i", &res) ) { |
