summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Vogt <mvo@debian.org>2010-09-28 15:47:11 +0200
committerMichael Vogt <mvo@debian.org>2010-09-28 15:47:11 +0200
commit2fbf311c42e3320d677163cffe5b8914cd189e52 (patch)
tree5a134874771b316602e1437670a7d784ea7c632a
parentb1cc657924729fba2288f1f79b7ad7b091b709f6 (diff)
parent2d771cd542128fa347c353ddb6cdad5a684652f3 (diff)
downloadpython-apt-2fbf311c42e3320d677163cffe5b8914cd189e52.tar.gz
do use PyString_FromFormat(), in python versions below 2.7 it
does not support long long (%llu), use strprintf() from libapt instead
-rw-r--r--debian/changelog3
-rw-r--r--python/acquire-item.cc21
2 files changed, 16 insertions, 8 deletions
diff --git a/debian/changelog b/debian/changelog
index d9f6c7f4..d5a3e31f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -30,6 +30,9 @@ python-apt (0.7.98) UNRELEASED; urgency=low
* python/acquire-item.cc:
- fix two more int -> long long change to follow the changes
from libapt
+ - do use PyString_FromFormat(), in python versions below 2.7 it
+ does not support long long (%llu), use strprintf() from libapt
+ instead
[ Kiwinote ]
* apt/debfile:
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)