From c4737d7b5b88059597061eb29364eed37b7f2230 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Sun, 30 Mar 2025 16:10:43 +0000 Subject: [PATCH] python: Make dist() work again Signed-off-by: Michael Tremer --- src/python/pakfire.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/python/pakfire.c b/src/python/pakfire.c index 3c393857..cfe3466d 100644 --- a/src/python/pakfire.c +++ b/src/python/pakfire.c @@ -360,16 +360,16 @@ static PyObject* Pakfire_version_compare(PakfireObject* self, PyObject* args) { static PyObject* Pakfire_dist(PakfireObject* self, PyObject* args) { struct pakfire_archive* archive = NULL; const char* path = NULL; - const char* target = NULL; - char* result = NULL; + PyObject* ret = NULL; int r; - if (!PyArg_ParseTuple(args, "s|z", &path, &target)) + // Parse arguments + if (!PyArg_ParseTuple(args, "s", &path)) return NULL; Py_BEGIN_ALLOW_THREADS - r = pakfire_dist(self->pakfire, path, &archive, &result); + r = pakfire_dist(self->pakfire, path, &archive, NULL); if (r) { Py_BLOCK_THREADS PyErr_SetFromErrno(PyExc_OSError); @@ -378,10 +378,11 @@ static PyObject* Pakfire_dist(PakfireObject* self, PyObject* args) { Py_END_ALLOW_THREADS - PyObject* ret = PyUnicode_FromString(result); - free(result); + // Create a new archive + ret = new_archive(&ArchiveType, archive); - // XXX This is now very broken + if (archive) + pakfire_archive_unref(archive); return ret; } -- 2.39.5