]> git.ipfire.org Git - pakfire.git/commitdiff
python: Make dist() work again
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 30 Mar 2025 16:10:43 +0000 (16:10 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 30 Mar 2025 16:10:43 +0000 (16:10 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/python/pakfire.c

index 3c393857a002246261bf8ca4820441ee5fc2c8e6..cfe3466d71a4e48f365748e8cd32e5d02732c2c6 100644 (file)
@@ -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;
 }