]> git.ipfire.org Git - pakfire.git/commitdiff
problems: Show problem string in repr
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 2 Nov 2017 15:09:42 +0000 (16:09 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 2 Nov 2017 15:09:42 +0000 (16:09 +0100)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/_pakfire/problem.c

index bd01ff9c024b3512f590a91c1e2c3a138bc0a180..1254a60730e884218eccce0c18ea0d05d2108bc6 100644 (file)
@@ -72,6 +72,12 @@ static int Problem_init(ProblemObject* self, PyObject* args, PyObject* kwds) {
        return 0;
 }
 
+static PyObject* Problem_repr(ProblemObject* self) {
+       const char* string = pakfire_problem_to_string(self->problem);
+
+       return PyUnicode_FromFormat("<_pakfire.Problem %s>", string);
+}
+
 static PyObject* Problem_string(ProblemObject* self) {
        const char* string = pakfire_problem_to_string(self->problem);
 
@@ -119,5 +125,6 @@ PyTypeObject ProblemType = {
        tp_doc:             "Problem object",
        tp_methods:         Problem_methods,
        tp_getset:          Problem_getsetters,
+       tp_repr:            (reprfunc)Problem_repr,
        tp_str:             (reprfunc)Problem_string,
 };