From: Michael Tremer Date: Thu, 6 Feb 2025 11:04:39 +0000 (+0000) Subject: python: Minor code cleanup X-Git-Tag: 0.9.30~117 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=18164fd1ab0de5d8e83a8f740e09c86422794375;p=pakfire.git python: Minor code cleanup Signed-off-by: Michael Tremer --- diff --git a/src/python/file.c b/src/python/file.c index 7c5e9cbe..ce366282 100644 --- a/src/python/file.c +++ b/src/python/file.c @@ -28,9 +28,7 @@ #include "pakfire.h" #include "util.h" -PyObject* new_file(struct pakfire_file* file) { - PyTypeObject* type = &FileType; - +PyObject* new_file(PyTypeObject* type, struct pakfire_file* file) { FileObject* self = (FileObject *)type->tp_alloc(type, 0); if (self) { self->file = pakfire_file_ref(file); diff --git a/src/python/file.h b/src/python/file.h index 3ce22aeb..0494b688 100644 --- a/src/python/file.h +++ b/src/python/file.h @@ -32,6 +32,6 @@ typedef struct { extern PyTypeObject FileType; -PyObject* new_file(struct pakfire_file* file); +PyObject* new_file(PyTypeObject* type, struct pakfire_file* file); #endif /* PYTHON_PAKFIRE_FILE_H */ diff --git a/src/python/util.c b/src/python/util.c index f1abd0cd..d0cdb731 100644 --- a/src/python/util.c +++ b/src/python/util.c @@ -98,7 +98,7 @@ PyObject* PyList_FromFileList(struct pakfire_filelist* filelist) { goto ERROR; // Create a new File object - f = new_file(file); + f = new_file(&FileType, file); if (!f) goto ERROR;