From 18164fd1ab0de5d8e83a8f740e09c86422794375 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Thu, 6 Feb 2025 11:04:39 +0000 Subject: [PATCH] python: Minor code cleanup Signed-off-by: Michael Tremer --- src/python/file.c | 4 +--- src/python/file.h | 2 +- src/python/util.c | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/python/file.c b/src/python/file.c index 7c5e9cbec..ce3662824 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 3ce22aeb2..0494b6885 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 f1abd0cd1..d0cdb7315 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; -- 2.39.5