diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2010-09-28 15:59:13 +0200 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2010-09-28 15:59:13 +0200 |
| commit | e84f2882720a042cf3ef7941dae0e37851eaaef5 (patch) | |
| tree | 371613166fe03ccae17dc582955579a226c3bac6 | |
| parent | eafb17c880c643b7e9223e673e51d7ce5a10cef5 (diff) | |
| parent | 2d771cd542128fa347c353ddb6cdad5a684652f3 (diff) | |
| download | python-apt-e84f2882720a042cf3ef7941dae0e37851eaaef5.tar.gz | |
use strprintf() from libapt instead of PyString_FromFormat()
because PyString_FromFormat() does not support %llu in python
versions below 2.7
| -rw-r--r-- | debian/changelog | 3 | ||||
| -rw-r--r-- | python/acquire-item.cc | 21 |
2 files changed, 16 insertions, 8 deletions
diff --git a/debian/changelog b/debian/changelog index 98f9091e..010c30c1 100644 --- a/debian/changelog +++ b/debian/changelog @@ -5,6 +5,9 @@ python-apt (0.7.96.1ubuntu12) maverick; urgency=low * python/acquire-item.cc: - fix two more int -> long long change to follow the changes from libapt + - use strprintf() from libapt instead of PyString_FromFormat() + because PyString_FromFormat() does not support %llu in python + versions below 2.7 -- Michael Vogt <michael.vogt@ubuntu.com> Fri, 24 Sep 2010 21:22:38 +0200 diff --git a/python/acquire-item.cc b/python/acquire-item.cc index 377b077a..895d4a21 100644 --- a/python/acquire-item.cc +++ b/python/acquire-item.cc @@ -160,14 +160,19 @@ static PyObject *acquireitem_repr(PyObject *Self) pkgAcquire::Item *Itm = acquireitem_tocpp(Self); if (Itm == 0) return 0; - return PyString_FromFormat("<%s object: " - "Status: %i Complete: %i Local: %i IsTrusted: %i " - "FileSize: %llu DestFile:'%s' " - "DescURI: '%s' ID:%lu ErrorText: '%s'>", - Self->ob_type->tp_name, - Itm->Status, Itm->Complete, Itm->Local, Itm->IsTrusted(), - Itm->FileSize, Itm->DestFile.c_str(), Itm->DescURI().c_str(), - Itm->ID,Itm->ErrorText.c_str()); + // FIXME: once python 2.7 is default we can use: + // return PyString_FromFormat() + // but for < 2.7 the "%llu" is not supported + string repr; + strprintf(repr, "<%s object:" + "Status: %i Complete: %i Local: %i IsTrusted: %i " + "FileSize: %llu DestFile:'%s' " + "DescURI: '%s' ID:%lu ErrorText: '%s'>", + Self->ob_type->tp_name, + Itm->Status, Itm->Complete, Itm->Local, Itm->IsTrusted(), + Itm->FileSize, Itm->DestFile.c_str(), Itm->DescURI().c_str(), + Itm->ID,Itm->ErrorText.c_str()); + return CppPyString(repr); } static void acquireitem_dealloc(PyObject *self) |
