From f441b008883170d6a8c4cfeb814b0c07a27e6afd Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Tue, 12 Apr 2011 11:38:25 +0200 Subject: apt_pkg: Fix unsigned/long-vs-int issues (LP: #610820) This fix is large, but simple in concept. Instead of relying on Py_BuildValue and type signatures, or type-specific conversion functions, create a new set of overloaded MkPyNumber() functions that automatically do the right thing for each numerical type. --- python/policy.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'python/policy.cc') diff --git a/python/policy.cc b/python/policy.cc index 7eccb30c..b11e4dde 100644 --- a/python/policy.cc +++ b/python/policy.cc @@ -45,7 +45,7 @@ PyObject *policy_get_priority(PyObject *self, PyObject *arg) { pkgPolicy *policy = GetCpp(self); if (PyObject_TypeCheck(arg, &PyPackage_Type)) { pkgCache::PkgIterator pkg = GetCpp(arg); - return Py_BuildValue("i", policy->GetPriority(pkg)); + return MkPyNumber(policy->GetPriority(pkg)); } else { PyErr_SetString(PyExc_TypeError,"Argument must be of Package()."); return 0; -- cgit v1.2.3